[gdal-dev] Fillvalue set incorrectly on gdal_translate to NetCDF for Byte

Julian Zeidler gdal at zeidlers.de
Wed Sep 27 01:00:23 PDT 2017


Hi all,

I noticed, what I believe is an Error when converting a Byte Image from 
geotiff to Netcdf. In the newest Gdal Version (trunk from Monday),  it 
reports the correkt NoData Value (in older gdal Version  i tested this 
1.11 this was also incorrekt) but it reports the _FillValue as -1 while 
reporting that the Dataset is _Unsigned. This looks like the FillValue 
is written as a signed byte (For Na=254 it reports fillvalue=-2).

Is this difference between noData and _FillValue intentional? And is 
there any way to "fix" the FillValue in my Netcdf ?

I ran  gdal_translate example.tif example.nc -of netCDF

The tiff reports the (korrekt) NaValue as :

Band 1 Block=2000x4 Type=Byte, ColorInterp=Gray
   NoData Value=255

While in the NetCDF I get :

Band 1 Block=2000x1 Type=Byte, ColorInterp=Undefined
   NoData Value=255
   Metadata:
     grid_mapping=transverse_mercator
     long_name=GDAL Band Number 1
     NETCDF_VARNAME=Band1
     valid_range={0,255}
     _FillValue=-1
     _Unsigned=true

Best


Julian



More information about the gdal-dev mailing list