This works, but is clumsy, since there is no need to involve the grid at all.
Is there any better way to get the bounding box of a region, -R, and a projection, -J? I tried all -W options in mapproject, but none gave me what I need (i.e., what grdinfo gives me).
The -R is not the same as my grid; it’s given by the resulting bounding box from -JS$lon/$lat/20c -R40+uk. That’s why I mentioned that the grid does not have anything to do with finding it, and thus grdinfo feels ‘wrong for the task’.
grdinfo -Ib outputs (from my original post) many lines of lon/lat points, which I can plot with plot. But there should be no need for grdinfo, mapproject should be able to do it, but I can’t see how (and maybe I’m wrong).
I need the bounding box of the area shown in my main map, to feed plot in an inset map. Here’s the code:
gmt inset begin -DjTL+w3c+o0.2c
[...]
gmt grdinfo -Ib grid.nc $(gmt mapproject -JS$lon/$lat/20c -R40+uk -WE) | gmt plot # plot bounding box of main map for overview on inset map
gmt inset end
Again, using grdinfo seems wrong, since I do not need a grid to make a bounding box of a given -J and -R.
I think I can manually create the bounding box, based on output from mapproject, and plot with plot -A.., but I want to check if there exists a ‘ready made option’ for this already.