Hello, I just upgraded to 6.3.0 (the default supplied with ubuntu 22.04) from 6.0.0 (the default supplied with ubuntu 20.04), and am encountering a new error where grids generated by grdsample and grdmask produce different sized output grids when given the exact same region (-R-119.38/-116.85/33.25/35.08) and grid spacing (-I3c).
First, I create a mask file that I will later use in a grdmath command:
kevin@steel:/tmp/1680195554578-0$ cat mask.xy
-119.38000000000001 34.13
-117.5 33.25
-116.85000000000001 34.19
-118.74999999999999 35.08
-119.38000000000001 34.13
kevin@steel:/tmp/1680195554578-0$ gmt grdmask mask.xy -R-119.38/-116.85/33.25/35.08 -I3c -NNaN/1/1 -Gmask.grd
kevin@steel:/tmp/1680195554578-0$ gmt grdinfo mask.grd
mask.grd: Title: z
mask.grd: Command: grdmask mask.xy -R-119.38/-116.85/33.25/35.08 -I3c -NNaN/1/1 -Gmask.grd
mask.grd: Remark:
mask.grd: Gridline node registration used [Cartesian grid]
mask.grd: Grid file format: nf = GMT netCDF format (32-bit float), CF-1.7
mask.grd: x_min: -119.38 x_max: -116.85 x_inc: 0.000833333333333 name: x n_columns: 3037
mask.grd: y_min: 33.25 y_max: 35.08 y_inc: 0.000833333333333 name: y n_rows: 2197
mask.grd: v_min: 1 v_max: 1 name: z
mask.grd: scale_factor: 1 add_offset: 0
mask.grd: format: netCDF-4 chunk_size: 133,130 shuffle: on deflation_level: 3
Then, I use grdsample to resample a lower resolution grid to match:
kevin@steel:/tmp/1680195554578-0$ gmt grdinfo interp_diff.grd
interp_diff.grd: Title: Produced by grdmath
interp_diff.grd: Command: grdmath base_map.grd interp_resampled.grd ADD = interp_diff.grd
interp_diff.grd: Remark:
interp_diff.grd: Gridline node registration used [Cartesian grid]
interp_diff.grd: Grid file format: nf = GMT netCDF format (32-bit float), CF-1.7
interp_diff.grd: x_min: -119.38 x_max: -116.85 x_inc: 0.005 name: x n_columns: 507
interp_diff.grd: y_min: 33.25 y_max: 35.08 y_inc: 0.005 name: degree n_rows: 367
interp_diff.grd: v_min: -6.64150381088 v_max: -3.09947729111 name: degree
interp_diff.grd: scale_factor: 1 add_offset: 0
interp_diff.grd: format: netCDF-4 chunk_size: 169,184 shuffle: on deflation_level: 3
kevin@steel:/tmp/1680195554578-0$ gmt grdsample interp_diff.grd -Gtopores_interp_diff.grd -I3c -nl -R-119.38/-116.85/33.25/35.08
kevin@steel:/tmp/1680195554578-0$ gmt grdinfo topores_interp_diff.grd
topores_interp_diff.grd: Title: z
topores_interp_diff.grd: Command: grdsample interp_diff.grd -Gtopores_interp_diff.grd -I3c -nl -R-119.38/-116.85/33.25/35.08
topores_interp_diff.grd: Remark:
topores_interp_diff.grd: Gridline node registration used [Geographic grid]
topores_interp_diff.grd: Grid file format: nf = GMT netCDF format (32-bit float), CF-1.7
topores_interp_diff.grd: x_min: -119.38 x_max: -116.850833333 x_inc: 0.000833333333333 (3 sec) name: longitude n_columns: 3036
topores_interp_diff.grd: y_min: 33.25 y_max: 35.08 y_inc: 0.000833333333333 (3 sec) name: latitude n_rows: 2197
topores_interp_diff.grd: v_min: -6.64150381088 v_max: -3.09947729111 name: z
topores_interp_diff.grd: scale_factor: 1 add_offset: 0
topores_interp_diff.grd: format: netCDF-4 chunk_size: 132,130 shuffle: on deflation_level: 3
Note that the grid output of the grdsample command has 3036 columns, and the output of the grdmask command has 3307 columns. A potential clue is that the grid created with grdsample says “x_inc: 0.000833333333333 (3 sec)” whereas the grid created with grdmask does not contain the “(3 sec)” annotation.
I have found some other topics with similar issues, e.g. this, but I have node registration. I do notice that the grid generated by grdmask is listed as “Gridline node registration used [Cartesian grid]” and that generated by grdsample is “Gridline node registration used [Geographic grid]”, maybe another clue?
Any ideas what’s going on here and how to avoid this difference?
Thanks!