GRD2XYZ changes x_min and y_min

Hi, I’m working in a tsunami simulation and i need to do nested grids in xyz format, and i’ve obtained the bathymetry grids from gebco. When I transform the nc to xyz the limit values changes

~/Escritorio/batimetrias/Global/gebco > gmt grdinfo gebco_1min.nf 14:50:53
gebco_1min.nf: Title:
gebco_1min.nf: Command: gmt grdsample gebco_2024_n-17.0_s-43.0_w-76.0_e-69.0.nc -I1m -Ggebco_1min.nf
gebco_1min.nf: Remark:
gebco_1min.nf: Pixel node registration used [Geographic grid]
gebco_1min.nf: Grid file format: nf = GMT netCDF format (32-bit float), CF-1.7
gebco_1min.nf: x_min: -76.000000 x_max: -69.000000 x_inc: 0.016667 (1 min) name: longitude n_columns: 420
gebco_1min.nf: y_min: -43.000000 y_max: -17.000000 y_inc: 0.016667 (1 min) name: latitude n_rows: 1560
gebco_1min.nf: v_min: -8079.656250 v_max: 6507.726562 name: z
gebco_1min.nf: scale_factor: 1.000000 add_offset: 0.000000
gebco_1min.nf: format: netCDF-4 chunk_size: 140,130 shuffle: on deflation_level: 3
gebco_1min.nf: Default CPT:

~/Escritorio/batimetrias/Global/gebco > gmt grd2xyz gebco_1min.nf > gebco_1min_gmt.xyz 14:51:16

~/Escritorio/batimetrias/Global/gebco > gmt grdinfo gebco_1min_gmt.xyz 14:52:03
gebco_1min_gmt.xyz: Title: Grid imported via GDAL
gebco_1min_gmt.xyz: Command:
gebco_1min_gmt.xyz: Remark:
gebco_1min_gmt.xyz: Gridline node registration used [Cartesian grid]
gebco_1min_gmt.xyz: Grid file format: gd = Import/export through GDAL
gebco_1min_gmt.xyz: x_min: -75.991667 x_max: -69.008333 x_inc: 0.016667 name: x n_columns: 420
gebco_1min_gmt.xyz: y_min: -42.991668 y_max: -17.008334 y_inc: 0.016667 name: y n_rows: 1560
gebco_1min_gmt.xyz: v_min: -8079.656250 v_max: 6507.726562 name: z
gebco_1min_gmt.xyz: scale_factor: 1.000000 add_offset: 0.000000
gebco_1min_gmt.xyz: Default CPT:

Do someone know why happen? and some fix?

Regards!

gebco_1min.nf: Pixel node registration used [Geographic grid]
vs
gebco_1min_gmt.xyz: Gridline node registration used [Cartesian grid]

the coordinates shifted by 1/2*x_inc (or y_inc) due to change in grid registration, while z data remained unchanged.

e.g. 76.000000 - 1/2*0.016667 = 75.9916665
gebco_1min_gmt.xyz: x_min: -75.991667

1 Like

Why does grd2xyz change the registration?

I guess it did not really, just the question of definition in this case. Because this:

gebco_1min.nf: Pixel node registration used [Geographic grid]
gebco_1min.nf: Grid file format: nf = GMT netCDF format (32-bit float), CF-1.7
gebco_1min.nf: x_min: -76.000000 x_max: -69.000000 x_inc: 0.016667 (1 min) name: longitude n_columns: 420
gebco_1min.nf: y_min: -43.000000 y_max: -17.000000 y_inc: 0.016667 (1 min) name: latitude n_rows: 1560

is essentially exactly the same as this

gebco_1min_gmt.xyz: Gridline node registration used [Cartesian grid]
gebco_1min_gmt.xyz: Grid file format: gd = Import/export through GDAL
gebco_1min_gmt.xyz: x_min: -75.991667 x_max: -69.008333 x_inc: 0.016667 name: x n_columns: 420
gebco_1min_gmt.xyz: y_min: -42.991668 y_max: -17.008334 y_inc: 0.016667 name: y n_rows: 1560

GMT does not change the node coordinates. It’s just that with pixel registration they may not be what people expect (or the other way around if user is not familiar with grid registration).

If you are doing tsunami simulations with nested grids (not obvious the create those), you may be interested in Mirone (windows only) and these tutorials.

http://joa-quim.pt/mirone/howtos/Compute_seismic_elastic_deformation.pdf
http://joa-quim.pt/mirone/howtos/A_simple_tsunami_propagation_example.pdf
http://joa-quim.pt/mirone/howtos/A_nested_grids_approach.pdf

2 Likes

Thank you so much!

thank you for the explaination!