Two grids with same geographic bounds have different nx and ny spacing?

Hi,

I have two grids made with grdcut and grdsample which show the same (?) exact geographic bounds and sampling and grid registration, but won’t compute because there’s a mismatch in nx and by. See the output of grdinfo below. What am I missing/how is this possible?

I’ve tried a bunch of different reformatting and things, but beats me how this could happen?

Thanks!

Thorsten

Grid 1:

/tmp/tmp.S4WdkqHqoO.topo.grd: Title: z
/tmp/tmp.S4WdkqHqoO.topo.grd: Command: grdsample -nl -fg -I36s -fg /tmp/tmp.S4WdkqHqoO.2.grd -G/tmp/tmp.S4WdkqHqoO.topo.grd
/tmp/tmp.S4WdkqHqoO.topo.grd: Remark:
/tmp/tmp.S4WdkqHqoO.topo.grd: Pixel node registration used [Geographic grid]
/tmp/tmp.S4WdkqHqoO.topo.grd: Grid file format: nf = GMT netCDF format (32-bit float), CF-1.7
/tmp/tmp.S4WdkqHqoO.topo.grd: x_min: -121 x_max: -115.25 x_inc: 0.01 (36 sec) name: longitude n_columns: 575
/tmp/tmp.S4WdkqHqoO.topo.grd: y_min: 32.75 y_max: 36.5 y_inc: 0.01 (36 sec) name: latitude n_rows: 375
/tmp/tmp.S4WdkqHqoO.topo.grd: v_min: -3943.72998047 v_max: 3759.80004883 name: z
/tmp/tmp.S4WdkqHqoO.topo.grd: scale_factor: 1 add_offset: 0
/tmp/tmp.S4WdkqHqoO.topo.grd: format: netCDF-4 chunk_size: 144,188 shuffle: on deflation_level: 3

Grid 2:

/tmp/tmp.S4WdkqHqoO.diff.i.grd: Title: z
/tmp/tmp.S4WdkqHqoO.diff.i.grd: Command: grdsample -nl /tmp/tmp.S4WdkqHqoO.diff.2.grd -I36s -fg -G/tmp/tmp.S4WdkqHqoO.diff.i.grd
/tmp/tmp.S4WdkqHqoO.diff.i.grd: Remark:
/tmp/tmp.S4WdkqHqoO.diff.i.grd: Gridline node registration used [Geographic grid]
/tmp/tmp.S4WdkqHqoO.diff.i.grd: Grid file format: nf = GMT netCDF format (32-bit float), CF-1.7
/tmp/tmp.S4WdkqHqoO.diff.i.grd: x_min: -121 x_max: -115.25 x_inc: 0.01 (36 sec) name: longitude n_columns: 576
/tmp/tmp.S4WdkqHqoO.diff.i.grd: y_min: 32.75 y_max: 36.5 y_inc: 0.01 (36 sec) name: latitude n_rows: 376
/tmp/tmp.S4WdkqHqoO.diff.i.grd: v_min: 0.0116347996518 v_max: 84.9326019287 name: z
/tmp/tmp.S4WdkqHqoO.diff.i.grd: scale_factor: 1 add_offset: 0
/tmp/tmp.S4WdkqHqoO.diff.i.grd: format: netCDF-4 chunk_size: 144,188 shuffle: on deflation_level: 3

Looks like the first grid uses pixel node registration and the second uses gridline node registration, so the latter has one additional row and column.

grdedit -T may handle the registration conversion

I agree with @jaltekruse. You could also add -T in grdsample.

Thanks much, both! Sorry that this was obvious, I thought I’d checked that the registration was the same, but I confused myself! I cannot get the regions and increments to be the same after the conversion with grdedit or grdssample but I can probably figure it out!

1 Like