How to use "grdlandmask" to make gridded values on land NaN?

I have a gridded variable named Var (size: 1440 x 720). It was put onto a grid defined by longitude 20:0.25:379.75 and latitude -90:0.25:89.75.

Below was how I applied land/sea mask at 200 meter depth myself. I used the GEBCO database:
fi = griddata … # 3-column: lon, lat and elevation/depth.
Index = fi .> -200;
Var[Index] .= NaN;

I just spotted some issues related to the GEBCO data, and am exploring how to achieve that using the GMT command of grdlandmask.

Below is the instructions from the GMT.jl documentation. Unfortunately, I’m struggling to follow the instructions here. Could anyone please share how this can be done in Julia?

Many thanks!

I have warned you already that grid is wrong. 1440 is the number of columns, not the number of rows.

Regarding the docs, the GMT documentation is very large and many man pages were not converted to the Julia wrappers. In those cases, like the grdlandmask, when more details are needed onehas to consult the GMT doc which linked at the very beginning of the page you posted above.

This will compute a land mask

G = grdlandmask(region=global, inc=0.25, resolution=:low);
1 Like