Understanding grdimage -E

Is there a reason gmt grdimage -E# clips the grid’s image? In the example below, I expected the grid’s image in all four subplots to have the same extent, i.e. covering the range -R0.5/2.5/0.5/2.5, but using -E300 (etc.) clips the grid’s image to -R1/2/1/2. The docs -E say this sets the resolution of the projected grid for non-linear/mercator map projections, but the same happens with -JB for example (but maybe this is effectively linear at these coordinates?).

gmt begin demo_E png
  gmt xyz2grd -I1 -R1/2/1/2 -Gdemo_gridline.grd  << EOD
1 1 1
1 2 2
2 1 3
2 2 4
EOD

  gmt makecpt -Cwhite,blue -T0/4

  gmt subplot begin 1x4 -Fs2i/0 -R0/3/0/3 -JX2i -Sc -Bwesn -Bg1 -A+jTC+gwhite
  
  gmt subplot set -A"GRDVIEW"
  gmt grdview demo_gridline.grd  -T+owhite -C

  gmt subplot set -A"GRDIMAGE"
  gmt grdimage demo_gridline.grd -C

  gmt subplot set -A"GRDIMAGE -E300"
  gmt grdimage demo_gridline.grd -C -E300

  gmt subplot set -A"GRDIMAGE -Ei"
  gmt grdimage demo_gridline.grd -C -Ei

  gmt subplot end

gmt end show

I think for -Edpi the problem is that we honour the grids -R as given (1/2) and not considering the fact that the original node represents data from 0.5 to 1.5, etc. Perhaps we need to change the w/e/s/n passed to the interpolator here.

1 Like