Skip to content

grdmask with region '-Rg' not recognising longitudes more than 180  #8340

Closed

Description

@JonathonLeonard

We are having a problem where grdmask is not recognising topologies that have a longitude between 180-360 when the region is set to '-Rg'. However it seems to work fine with region set it '-Rd'.

To demonstrate I have attached a folder with a script and a sample topology file:
grdmask_issue.zip

The topology file contained in the above file (test_topology.xy) defines three polygons- two that have longitudes <180 and one >180. For completeness, here is the contents of test_topology.xy:

> An example of a polygon that works fine with grdmask
0 0
0 -5
5 -5
5 0
0 0
> This works too
170 -20
170 -25
180 -25
180 -20
170 -20
> An example of a polygon between 181 and 360 that doesn't plot
189 -20
189 -25
194 -25
194 -20
189 -20

The below line of code will not recognise the polygon >180:

gmt grdmask -Rg test_topology.xy -I0.25 -N0/0/1 -r -Vd -GRg_flat_slab_mask.nc

While the below line will recognise all polygons:

gmt grdmask -Rd test_topology.xy -I0.25 -N0/0/1 -r -Vd -GRd_flat_slab_mask.nc

A work around would be to do the grdmask command with '-Rd' then use grdedit -S -Rg to have it back to the 0-360 longitude range, however I just thought I'd report this bug to see if anyone has any idea what's going on.

Actual outcome
Only polygons that exist within longitudes <180 will be masked by grdmask

Expected outcome
All polygons that exist from 0-360 longitude should be masked.

System information

  • Operating system: MacOS Monterey (on an M1 Apple Silicon Chip)
  • GMT version (gmt --version): 6.4.0

Activity

  1. added
    bug
    on Jan 31, 2024
  2. welcome commented on Jan 31, 2024

    @welcome

    👋 Thanks for opening your first issue here! Please make sure you filled out the template with as much detail as possible. We appreciate that you took the time to contribute!

    Please make sure you read our Contributing Guide and abide by our Code of Conduct.

  3. joa-quim commented on Apr 25, 2026

    @joa-quim
    Member

    Sorry for the long silence. PR #9001 should fix this, but let's see if doesn't break something else.

  4. joa-quim commented on Apr 26, 2026

    @joa-quim
    Member

    Fixed by #9001

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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions