-
Notifications
You must be signed in to change notification settings - Fork 224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add clip parameter to pygmt.Figure.coast #1706
base: main
Are you sure you want to change the base?
Conversation
This PR adds an alias for the ``-Q`` flag which I need to set up a new gallery example.
I like how GMT.jl handles clipping through the coast module (https://www.generic-mapping-tools.org/GMT.jl/dev/#GMT.coast) using a |
Sounds like a perfect solution to me, thanks @meghanrjones! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to also add some unit tests to test_coast.py
to cover the clip parameter. Maybe one for a land clip and one for a water clip.
I agree. |
Possibly, I will look into this idea a bit more based the gmt clip module, which is very similar to these combinations of options to coast. |
Yes, after testing the feasibility with #1779, I still think that using a context manager for clipping land, water, and countries would be a good idea. @michaelgrund, I am sorry for not having my thoughts in order on the first review of this PR. Here are the various options that I know of that set clipping paths in GMT:
I think it would be better to have this functionality organized together in the PyGMT API rather than spread out amongst the other functions, but I'm not sure what the best way to accomplish that would be. |
Totally agree with you @meghanrjones, should be bundled together. How should we continue with this PR? |
I recommend leaving it as is briefly until we find out whether GMT can internally handle the -X -Y shifts when using clip paths (GenericMappingTools/gmt#6406) because the result from that discussion could impact our design of these functions. |
I saw the corresponding GMT PR was merged with only a fix in the docs @maxrjones. Do you think we can continue here? |
Yes, continuing sounds good. Here's how I imagine the API looking with the various clip options being organized in a single namespace:
Optionally, we could split up dcw, e.g., ( |
This looks like a good API design. If we decide to follow this API degisn, I think we should close this PR and then work in #1779 instead. Agree? |
Is it possible, or would there be a need though to do a combined clip? E.g. some polygon + dcw? |
That's a good question. GMT does support nested clipping paths:
So nested clipping in PyGMT should be like:
|
Description of proposed changes
This PR adds a
clip
parameter to the Figure.coast module:clip="land"
to clip dry areasclip="water"
to clip wet areasclip ="end"
to mark end of existing clip pathFixes #
Reminders
make format
andmake check
to make sure the code follows the style guide.doc/api/index.rst
.Slash Commands
You can write slash commands (
/command
) in the first line of a comment to performspecific operations. Supported slash commands are:
/format
: automatically format and lint the code/test-gmt-dev
: run full tests on the latest GMT development version