[gdal-dev] Failing to access a 8-bit SUBDATASET from GMT.

Joaquim Manuel Freire Luís jluis at ualg.pt
Tue Sep 12 07:30:48 PDT 2023


Hi,

I am getting an error in GMT when trying to read the "qual_sst" subdataset of this nc file
https://fct-gmt.ualg.pt/gmt/data/cache/A2016152023000.L2_LAC_SST.nc

But it's only that subdataset that errors.

gdalinfo A2016152023000.L2_LAC_SST.nc
...
  SUBDATASET_1_NAME=NETCDF:"A2016152023000.L2_LAC_SST.nc":/geophysical_data/sst
  SUBDATASET_1_DESC=[2030x1354] sea_surface_temperature (16-bit integer)
  SUBDATASET_2_NAME=NETCDF:"A2016152023000.L2_LAC_SST.nc":/geophysical_data/qual_sst
  SUBDATASET_2_DESC=[2030x1354] /geophysical_data/qual_sst (8-bit integer)
...

For example, this works (and works for all other subdasets except "qual_sst"):

gmt grd2xyz A2016152023000.L2_LAC_SST.nc=gd?NETCDF:"A2016152023000.L2_LAC_SST.nc":/geophysical_data/sst -ZTLf > lixo.b

but this fails with

ERROR 7: Assertion `false' failed in file `C:\progs_cygw\GMTdev\gmt5\master\src\gmt_gdalread.c', line 1402

The code in question starts in

https://github.com/GenericMappingTools/gmt/blob/master/src/gmt_gdalread.c#L1246

and debugging shows that GDALGetRasterDataType(hBand) is returning 14, which according to this page
https://gdal.org/api/raster_c_api.html#_CPPv412GDALDataType

indicates that the layer is interpreted to be GDT_CFloat64

I get the exact same error when loading that subdataset from my Julia wrapper, that inquires the gdal shared lib directly and does not use the code wrapped in GMT.

But GDAL itself does not have problems extracting the data. This works fine

gdal_translate NETCDF:"A2016152023000.L2_LAC_SST.nc":/geophysical_data/qual_sst qual_lixo.nc


Joaquim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20230912/8919e4a8/attachment.htm>


More information about the gdal-dev mailing list