GenericMappingTools / gmt

The Generic Mapping Tools
https://www.generic-mapping-tools.org
Other
825 stars 345 forks source link

grdconvert fails conversion to ESRI #204

Closed martaneres closed 5 years ago

martaneres commented 5 years ago

I start to convert ESRI grids to gmt, and do some operations with them. Then I want to save the results back in ESRI. However, when using grdconvert it gives the following:

grdconvert depth_reflector.grd -Gdepth_reflector.asc=ef grdconvert (api_export_grid): Only square pixels are allowed in ESRI grids [depth_reflector.asc=ef] Error returned from GMT API: GMT_GRID_WRITE_ERROR (19)

It seems to be saying that the grid is not squared, however xinc=yinc, at least as long as grdinfo is able to say.

I am sending the script, the input grids and two error prints.

Thanks for your concern

Marta

System information

welcome[bot] commented 5 years ago

👋 Thanks for opening your first issue here! Please make sure you filled out the template with as much detail as possible. We appreciate that you took the time to contribute!

PaulWessel commented 5 years ago

Running your commands first, the command

gmt grdconvert depth_reflector.grd -Gdepth_reflector.asc=ef

worked fine for me. What does gmt grdinfo depth_reflector.grd say?

martaneres commented 5 years ago

I attach a screen shot of the whole script run. in the last command, grdinfo gives xinc=yinc

thanks for your support

whole_script_run

joa-quim commented 5 years ago

Please show us the output of

grdinfo --FORMAT_FLOAT_OUT=%.15 depth_reflector.grd
grdinfo --FORMAT_FLOAT_OUT=%.15 reflector.grd 

No screenshots please. Just the plain text

martaneres commented 5 years ago

depth_reflector.grd: Command: grdmath depth_seafloor.grd temp.grd ADD = depth_reflector.grd
depth_reflector.grd: Remark:
depth_reflector.grd: Pixel node registration used [Cartesian grid]
depth_reflector.grd: Grid file format: nf = GMT netCDF format (32-bit float), COARDS, CF-1.5
depth_reflector.grd: x_min:  x_max:  x_inc:  name: x n_columns: 2910
depth_reflector.grd: y_min:  y_max:  y_inc:  name: y n_rows: 312
depth_reflector.grd: z_min:  z_max:  name: z
depth_reflector.grd: scale_factor:  add_offset:
depth_reflector.grd: format: netCDF-4 chunk_size: 133,156 shuffle: on deflation_level: 3

reflector.grd: Title: Produced by grdconvert
reflector.grd: Command: grdconvert et_fst_isb_015_v02.dat.asc=ef -Greflector.grd
reflector.grd: Remark:
reflector.grd: Pixel node registration used [Cartesian grid]
reflector.grd: Grid file format: nf = GMT netCDF format (32-bit float), COARDS, CF-1.5
reflector.grd: x_min:  x_max:  x_inc:  name: x n_columns: 2910
reflector.grd: y_min:  y_max:  y_inc:  name: y n_rows: 312
reflector.grd: z_min:  z_max:  name: z
reflector.grd: scale_factor:  add_offset:
reflector.grd: format: netCDF-4 chunk_size: 133,156 shuffle: on deflation_level: 3
joa-quim commented 5 years ago

Sorry, I chopped off one character in the printing format. It's

grdinfo --FORMAT_FLOAT_OUT=%.15g depth_reflector.grd
martaneres commented 5 years ago

depth_reflector.grd: Command: grdmath depth_seafloor.grd temp.grd ADD = depth_reflector.grd
depth_reflector.grd: Remark:
depth_reflector.grd: Pixel node registration used [Cartesian grid]
depth_reflector.grd: Grid file format: nf = GMT netCDF format (32-bit float), COARDS, CF-1.5
depth_reflector.grd: x_min: -58223.78 x_max: -43.859000000004 x_inc: 19.9931 name: x n_columns: 2910
depth_reflector.grd: y_min: 118602.82 y_max: 124840.6672 y_inc: 19.9931 name: y n_rows: 312
depth_reflector.grd: z_min: 33.6308670043945 z_max: 55.3236465454102 name: z
depth_reflector.grd: scale_factor: 1 add_offset: 0
depth_reflector.grd: format: netCDF-4 chunk_size: 133,156 shuffle: on deflation_level: 3
joa-quim commented 5 years ago

Please, the two of them.

joa-quim commented 5 years ago

It would also worth the trying of doing this operation via GDAL (using the =gd: .... mechanism, see the docs). Maybe that alternative code is less strict when comparing the x_inc/y_inc

PaulWessel commented 5 years ago

Also, what GMT version? 5 is not informative enough. What does gmt --version say?

joa-quim commented 5 years ago

Hmm, the input files are gone!!!

martaneres commented 5 years ago

reflector.grd: Command: grdconvert et_fst_isb_015_v02.dat.asc=ef -Greflector.grd
reflector.grd: Remark:
reflector.grd: Pixel node registration used [Cartesian grid]
reflector.grd: Grid file format: nf = GMT netCDF format (32-bit float), COARDS, CF-1.5
reflector.grd: x_min: -58223.78 x_max: -43.859000000004 x_inc: 19.9931 name: x n_columns: 2910
reflector.grd: y_min: 118602.82 y_max: 124840.6672 y_inc: 19.9931 name: y n_rows: 312
reflector.grd: z_min: 43.4642333984375 z_max: 70.5105361938477 name: z
reflector.grd: scale_factor: 1 add_offset: 0
reflector.grd: format: netCDF-4 chunk_size: 133,156 shuffle: on deflation_level: 3
martaneres commented 5 years ago

I had 5.4.3. I updated for 5.4.4, and it worked! Thanks

PaulWessel commented 5 years ago

Closing this issue.