Extract outline of actual coverage in a grid

# create a simple polygon that we use to cut
cat <<eof > cut.polygon
5.1 72.3
6.6 72.8
9.9 72.6
9.9 72.6
12.2 72.1
12.1 70.2
6.4 69.7
2.4 70.4
1.7 71.6
5.1 72.3
eof

# cut region
gmt grdcut @earth_relief_05m -RNO,SJ -Gno,sj.nc
# cut polygon
gmt grdcut no,sj.nc -Fcut.polygon -Gcut.nc

gmt grdclip -Srnan/-9999999999999999 -Gnan-trace.nc cut.nc

gmt begin cut png
gmt set GMT_THEME minimal

gmt grdimage -Cgeo cut.nc -JM10c -Baf -B+t"Trace area with data"
gmt grdimage -Cgeo no,sj.nc -JM10c -Baf -X11c
gmt grdcontour nan-trace.nc -C+-999999999999999 -D | gmt plot -Wthick

gmt end show

# clean up
rm cut.polygon no,sj.nc cut.nc nan-trace.nc gmt.history

2 Likes