[gdal-dev] Failure to fetch scale_factor and other on a subdataset of a L2 SST nc file (from OceanColor)
Joaquim Luis
jluis at ualg.pt
Wed May 11 14:56:32 PDT 2016
Hi,
In GMT we have this chunk of code to read Band metadata
if (GDALGetRasterScale(hBand, &bSuccess) != 1 ||
GDALGetRasterOffset(hBand, &bSuccess) != 0) {
Ctrl->band_field_names[nBand].ScaleOffset[0] = GDALGetRasterScale (hBand,
&bSuccess);
Ctrl->band_field_names[nBand].ScaleOffset[1] = GDALGetRasterOffset(hBand,
&bSuccess);
}
else {
...
http://gmt.soest.hawaii.edu/projects/gmt/repository/entry/trunk/src/gmt_gdalread.c#L452
and it works fine so far. However, when I use it on a SST L2 file from
OceanColor (a netCDF4 file) as in
grdinfo
A2016123140500.L2_LAC_SST.nc=gd?HDF5:"A2016123140500.L2_LAC_SST.nc"://geophysical_data/sst
(GMT syntax to access the subdataset), the calls to
GDALGetRasterScale(hBand, &bSuccess)
and friends return no data (bSuccess == 0 and confirmed in a debugger).
However, if add a temporary
char **papszMetadataBand = GDALGetMetadata(hBand, NULL);
int i, nCounterBand = CSLCount(papszMetadataBand);
for (i = 0; i < nCounterBand; i++)
fprintf(stderr, "Meta %d\t%s\n", i, papszMetadataBand[i]);
than the band's metadata is printed correctly (same info as that printed
with gdalinfo).
Question: is this what it looks, a bug?
Thanks
Joaquim
More information about the gdal-dev
mailing list