Hello,
I have a problem when using grdlandmask to cut data on water from GEBCO grid,
after using the mask I got positive values!
gmt begin
gmt grdlandmask -Rgebco2025.nc -I15s -Df -N1/NAN -Gmask.nc
gmt grdmath gebco2025.nc mask.nc MUL = gebco2025_sea.nc
gmt grdinfo gebco2025_sea.nc > gebco2025_sea.txt
gmt end
this is the info of the final grid
gebco2025_sea.nc: v_min: -4424 v_max: 874 name: Elevation relative to sea level [m]
Hi @MahmoudMagdy0. I think your problem may be related to the fact that grdlandmask uses the GSHHG dataset to create the mask, which differs from GEBCO.
You could try using grdclip instead of grdlandmask and grdmath.
thank you, I already uses grdclip for elevation grids, but I need to cut data on water from gravity and magnetic grids and I think grdclip will not fit.
so, here I tried GEBCO to explain the shift I may get with non_elevation grids.
If there is a way to do that with grdclip or any other modules, please tell me.
thank you.
Ok. I see.
What about if you create a grid with NaN for values above 0 and 1 for below 0, and then you use grdmath to keep the data on sea:
gmt grdclip gebco2025.nc -Gmask -Sa0/NaN -Sb0/1
gmt grdmath mask.nc gravity.nc MUL = gravity_sea.nc
good idea, it works thank you so much.