[gdal-dev] Failure to fetch scale_factor and other on a subdataset of a L2 SST nc file (from OceanColor)
Even Rouault
even.rouault at spatialys.com
Wed May 11 15:10:04 PDT 2016
Le mercredi 11 mai 2016 23:56:32, Joaquim Luis a écrit :
> 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_gda
> lread.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"://geoph
> ysical_data/sst
>
> (GMT syntax to access the subdataset), the calls to
In the above you use the HDF5 driver, not the netCDF one. As far as I can see,
GetScale() is implemented in the netCDF driver, but not in the HDF5 one.
>
> 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
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
--
Spatialys - Geospatial professional services
http://www.spatialys.com
More information about the gdal-dev
mailing list