[gdal-dev] netCDF signed nodata value

Even Rouault even.rouault at spatialys.com
Tue Oct 27 10:08:50 PDT 2015


Le mardi 27 octobre 2015 16:54:56, Kyle Shannon a écrit :
> Simon,
> 
> On Mon, Oct 26, 2015 at 5:04 PM, Simon Lyngby Kokkendorff
> 
> <silyko at gmail.com> wrote:
> > Hello list,
> > 
> >    Just observed a puzzling behaviour of the netCDF driver. When creating
> >    a
> > 
> > netCDF dataset of Byte type, the netCDF driver seems to interpret the
> > nodata value as a signed byte.
> > 
> >  For example a nodata value assigned with -a_nodata 200, will become -56.
> >  Of
> > 
> > course one can work around this by simply casting the nodata value (as
> > e.g. returned by band.GetNoDataValue()) to an unsigned byte.
> 
> It appears the driver has a sort of data type mis-match with no data
> and the band type.  A work around, if available, is to set FORMAT=NC4
> as a creation option.  I am not sure if it is in gdal or the netcdf
> library at this point.

My understanding is netCDF 3 only supports signed byte and GDAL uses a special 
metadata item _Unsigned=True to correct the interpretation. But it failed to 
use it to interpret correctly the nodata value. Should be fixed by 
https://trac.osgeo.org/gdal/ticket/6175 (happy to have feedback from anyone 
more knowleagable)

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list