Skip to content

pygmt.grdclip: Clip the range of grid values #3882

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

Open
4 of 9 tasks
seisman opened this issue Mar 29, 2025 · 3 comments
Open
4 of 9 tasks

pygmt.grdclip: Clip the range of grid values #3882

seisman opened this issue Mar 29, 2025 · 3 comments
Labels
feature request New feature wanted
Milestone

Comments

@seisman
Copy link
Member

seisman commented Mar 29, 2025

This is the central issue to track the implementation of the pygmt.grdclip method.

GMT options

Checked: Implemented; Unchecked: To be implemented/discussed; Strikethrough: Won't implement.

@seisman seisman added the feature request New feature wanted label Mar 29, 2025
@seisman seisman added this to the 0.4.0 milestone Mar 29, 2025
@seisman seisman moved this from 0) Wishlist to 3) Complete aliases in PyGMT: Wrapping GMT modules Mar 29, 2025
@seisman
Copy link
Member Author

seisman commented Mar 29, 2025

grdclip is one of the simple modules that have very few options. In PR #3883, I've tried to improve the pygmt.grdclip function, but before that, I'd like to ask your opinion about renaming the parameter new to replace.

-Srold/new
Set all data[i] == old to new. This is mostly useful when your data are known to be integer values. Repeat the option for as many replacements as are needed.

I feel replace is a better name than new.

@yvonnefroehlich
Copy link
Member

I feel replace is a better name than new.

For me a renaming to replace makes sense, as this alias is more descriptive.

@seisman
Copy link
Member Author

seisman commented Mar 31, 2025

-Sahigh/above[+e]
Sets all values where data[i] > high to above. The +e modifier includes equality, meaning data[i] ≥ high.

This option is aliased as above, with the Pythonic syntax accepting a two-value sequence (e.g., above=(100, 200)). However, there is no direct Pythonic equivalent for the +e modifier. If users need to include equality, a simple workaround is to slightly decrease high (e.g., above=(99.999, 200)). In other words, there is no need to implement a dedicated Pythonic solution for +e.

The same goes for -Sb.

For -Si and -Sr, both of them can be repeated for as many intervals as are needed. Currently, between and replace only accept 1-D sequence. PR #3883 will adds 2-D sequence support to these two parameters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature wanted
Projects
Status: 3) Complete aliases
Development

No branches or pull requests

2 participants