Skip to content
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

grdsample output is incorrect #3337

Open
seisman opened this issue Jul 18, 2024 · 0 comments
Open

grdsample output is incorrect #3337

seisman opened this issue Jul 18, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@seisman
Copy link
Member

seisman commented Jul 18, 2024

To reproduce the issue, see below:

In [1]: import pygmt

In [2]: from pygmt.helpers.testing import load_static_earth_relief

In [3]: pygmt.grdsample("@static_earth_relief.nc", region=[-53,-47,-20, -15], spacing=[2, 1])
grdsample [WARNING]: Output sampling interval in x exceeds input interval and may lead to aliasing.
Out[3]:
<xarray.DataArray 'z' (lat: 5, lon: 3)> Size: 120B
array([[460.84375, 482.78125, 848.6875 ],
       [680.46875, 519.09375, 760.84375],
       [867.75   , 579.03125, 804.875  ],
       [551.75   , 666.6875 , 934.09375],
       [411.3125 , 518.4375 , 879.875  ]])
Coordinates:
  * lat      (lat) float64 40B -19.5 -18.5 -17.5 -16.5 -15.5
  * lon      (lon) float64 24B -52.0 -50.0 -48.0
Attributes:
    Conventions:   CF-1.7
    title:
    history:       gmt grdsample @static_earth_relief.nc -G@GMTAPI@-S-O-G-G-G...
    description:
    long_name:     z
    actual_range:  [411.3125  934.09375]

In [4]: grid = load_static_earth_relief()

In [5]: pygmt.grdsample(grid, region=[-53,-47,-20, -15], spacing=[2, 1])
grdsample [WARNING]: Output sampling interval in x exceeds input interval and may lead to aliasing.
Out[5]:
<xarray.DataArray 'z' (lat: 5, lon: 3)> Size: 120B
array([[460.84375, 482.78125, 891.09375],
       [680.46875, 519.09375, 764.9375 ],
       [867.75   , 579.03125, 852.53125],
       [551.75   , 666.6875 , 958.21875],
       [411.3125 , 518.4375 , 931.28125]])
Coordinates:
  * lat      (lat) float64 40B -19.5 -18.5 -17.5 -16.5 -15.5
  * lon      (lon) float64 24B -52.0 -50.0 -48.0
Attributes:
    Conventions:   CF-1.7
    title:
    history:       gmt grdsample @GMTAPI@-S-I-G-M-G-N-000000 -G@GMTAPI@-S-O-G...
    description:
    long_name:     z
    actual_range:  [411.3125  958.21875]
@seisman seisman added the bug Something isn't working label Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant