Hi everyone,
I am noticing some potentially unexpected behavior when trying to find the common region between two grids using grdselect -Ai.
To demonstrate this, I will use a remote dataset at a crude resolution. The code below fetches the global grid, takes a subset of it with grdcut, then asks grdselect for the intersection between the two:
gmt grdcut @earth_geoid_01d_p -Rg -Gglobal.grd
gmt grdcut global.grd -R0/1/0/1 -Gsubset.grd
gmt grdselect -Ai global.grd subset.grd
I expect the above to return -R0/1/0/1. Instead, it produces a warning:
grdselect [WARNING]: No common area for all grids is possible.
If the first grid is not global, then we get a result that I would expect. Running
gmt grdcut global.grd -R0/15/0/15 -Gbigger_subset.grd
gmt grdselect -Ai subset.grd bigger_subset.grd
returns -R0/1/0/1.
Am I misunderstanding the output of -Ai? I am using GMT 6.6.0. Thanks!
Background/Context that isn’t directly related to my question above: I want to write a small script to perform grdmath operations on grids which do not have the same -R (but share registration [pixel] & resolution). One of the grids may be global, but not always. My plan was to have the script find their intersection, cut each grid to the intersection, and then perform the necessary grdmath operation.