Grids not same dimension after grdcut - for Bouguer anomaly gravfft example

Hello GMT community,

I am trying to follow along with the example from to get the Bouguer anomaly.

First I thought to cut the high-resolution remote dataset to the same size as the gravity data:

gmt grdcut @earth_relief_15s -Z -R161W/149W/41S/29S -Gpacific_bathy.grd
gmt grdcut -Z -R161W/149W/41S/29S -Gcut_grav.grd

After the cut and using grdinfo on
pacific_bathy.grd x_min: -161 x_max: -149 _bathy.grd: y_min: -41 y_max: -29
The dimensions are corrected but for the gravity
grdinfo cut_grav.grd x_min: -161.015625 x_max: -148.974609375 y_min: -41.0120187891 y_max: -28.988271151
I don’t quite understand why the dimensions are different.
Then I would like to:
gmt gravfft pacific_bathy.grd -D1665 -Gwater_g.grd -E4
gmt grdmath cut_grav.grd water_g.grd SUB = bouguer.grd
gmt grdimage bouguer.grd

I guess that one grid is pixel registration and the other is grid registration. You will need to convert one of them to the other registration.

You are absolutely right @EJFielding I missed it. The bathymetry is in pixel node registration while the gravity is in gridline node registration. Somehow use psconvert to convert the grid to pixel?

Maybe grdedit -T?

You can use grdedit -T to goggle registration. However, it is good to be aware that

  1. Do everything you can to always stay with the same registration so you don’t need to toggle at all.
  2. If you must toggle then be aware that you loose the grid’s power at the Nyquist frequency and you loose power at the shorter wavelengths as well.

Presumably nobody really wants to loose signal strength so best to not do this in the first place.

See for more of what Paul is describing.

1 Like

Thank you so much this is very helpful @Andreas @pwessel I will use a bathymetry grid with the gravity grid so I don’t need to toggle through the registration. If I can ask another question, when using grdmath I get the error grdmath [ERROR]: grid files not of same size! Is there a way to use grdsample so the grids are the same size?