[gdal-dev] Removing default nodata value from netCDF driver ?

Julien Demaria julien.demaria at acri-st.fr
Tue Nov 5 06:08:33 PST 2019


Hi Even,

Thanks for all the work.
I looked at the new pull request, it seems good but what do you think about adding support for case where nc_inq_var_fill() returns no_fill=1? In this case the current code uses fillvalue=zero by default (if I'm not wrong) which is not ideal, I think it is better to set bGotNoData to false.
And in creation mode do you confirm that it is not possible to create a variable without nodata value? What do you think about call nc_def_var_fill(NC_NOFILL) when creating the band and add a nc_def_var_fill(NC_FILL) call in SetNoDataValue()?

Julien


-----Message d'origine-----
De : Even Rouault <even.rouault at spatialys.com> 
Envoyé : mardi 5 novembre 2019 11:19
À : Julien Demaria <julien.demaria at acri-st.fr>
Cc : gdal-dev at lists.osgeo.org
Objet : Re: [gdal-dev] Removing default nodata value from netCDF driver ?

On mardi 5 novembre 2019 01:18:35 CET Julien Demaria wrote:
> Hi Even,
> 
> Are you sure that the driver uses a default fill value if the 
> attribute is not present?

Yes, the raster band constructor systematically called SetNoDataValue() even if the bGotNoData flag was not set before.

Thanks a lot for your very valuable feedback on this! I've issued in
https://github.com/OSGeo/gdal/pull/1983 a less radical change which follows your suggestions (and solves the issue that triggered this discussion), that
is:
- for char/byte/ubyte data types, do not set a NoData value if there's no explicit _FillValue or missing_value attribute
- for other data types, use nc_inq_var_fill() to get the default value, and fallback to the hard-coded NC_FILL_xxx constants

Even

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


More information about the gdal-dev mailing list