Skip to content

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

Closed
@seisman

Description

@seisman

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.

Activity

added this to the 0.4.0 milestone on Mar 29, 2025
moved this from 0) Wishlist to 3) Complete aliases in PyGMT: Wrapping GMT moduleson Mar 29, 2025
seisman

seisman commented on Mar 29, 2025

@seisman
MemberAuthor

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

yvonnefroehlich commented on Mar 29, 2025

@yvonnefroehlich
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

seisman commented on Mar 31, 2025

@seisman
MemberAuthor

-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.

moved this from 3) Complete aliases to 4) Gallery|tutorial example in PyGMT: Wrapping GMT moduleson Apr 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    4) Gallery|tutorial example

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @seisman@yvonnefroehlich

        Issue actions

          pygmt.grdclip: Clip the range of grid values · Issue #3882 · GenericMappingTools/pygmt