You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
pygmt.grdclip: Clip the range of grid values #3882
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.
PyGMT uses new
GMT.jl supports old or new (GMT.jl allows multiple aliases for the same option)
-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.
Activity
seisman commentedon Mar 29, 2025
grdclipis one of the simple modules that have very few options. In PR #3883, I've tried to improve thepygmt.grdclipfunction, but before that, I'd like to ask your opinion about renaming the parameternewtoreplace.newoldornew(GMT.jl allows multiple aliases for the same option)replaceornew(https://github.com/GenericMappingTools/gmt/blob/23be98456397b75c44f5701d1c47936739f021f7/src/longopt/grdclip_inc.h#L30)I feel
replaceis a better name thannew.yvonnefroehlich commentedon Mar 29, 2025
For me a renaming to
replacemakes sense, as this alias is more descriptive.seisman commentedon Mar 31, 2025
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
-Siand-Sr, both of them can be repeated for as many intervals as are needed. Currently,betweenandreplaceonly accept 1-D sequence. PR #3883 will adds 2-D sequence support to these two parameters.