<div dir="ltr"><div><div><div><div><div>Hello list,<br><br></div> 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. <br> 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.<br><br>A simple example:<br><br>>gdalinfo --version<br>GDAL 1.11.2, released 2015/02/10<br></div>>gdal_translate -of netCDF -a_nodata 200 something.tif <a href="http://something.nc">something.nc</a><br></div>>gdalinfo <a href="http://something.nc">something.nc</a><br>Driver: netCDF/Network Common Data Format<br>Files: <a href="http://something.nc">something.nc</a><br>Size is 10, 10<br>Coordinate System is `'<br>Origin = (0.000000000000000,10.000000000000000)<br>Pixel Size = (1.000000000000000,-1.000000000000000)<br>Metadata:<br> Band1#_FillValue=-56<br> Band1#_Unsigned=true<br> Band1#long_name=GDAL Band Number 1<br> Band1#valid_range={0,255}<br> lat#long_name=latitude<br> lat#standard_name=latitude<br> lat#units=degrees_north<br> lon#long_name=longitude<br> lon#standard_name=longitude<br> lon#units=degrees_east<br> NC_GLOBAL#Conventions=CF-1.5<br> NC_GLOBAL#GDAL=GDAL 1.11.2, released 2015/02/10<br> NC_GLOBAL#history=Mon Oct 26 23:58:09 2015: GDAL CreateCopy( <a href="http://something.nc">something.nc</a>, ... )<br>Corner Coordinates:<br>Upper Left ( 0.0000000, 10.0000000) <br>Lower Left ( 0.0000000, 0.0000000) <br>Upper Right ( 10.0000000, 10.0000000) <br>Lower Right ( 10.0000000, 0.0000000) <br>Center ( 5.0000000, 5.0000000) <br>Band 1 Block=10x1 Type=Byte, ColorInterp=Undefined<br> NoData Value=-56<br> Metadata:<br> _FillValue=-56<br> _Unsigned=true<br> long_name=GDAL Band Number 1<br> NETCDF_VARNAME=Band1<br> valid_range={0,255}<br><br></div>Cheers,<br></div>Simon Kokkendorff, DMI <br><div><div><div><br><br></div></div></div></div>