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

Julien Demaria julien.demaria at acri-st.fr
Tue Nov 5 07:41:47 PST 2019


Ok let's keep this for another PR.

no_fill is not only a write side optimization because nc_inq_var_fill() can be called when reading a file (the no_fill value is stored in the hidden NetCDF attribute _NoFill, you can print it with ncdump -s but it is only set when nofill=true).
My understanding is that the only way to define a NetCDF variable without a nodata value is to set no_fill=1 by calling nc_def_var_fill(NC_NOFILL) because no_fill=0 means you have to use the default fillvalue even if the _FillValue attribute is not set so you will always have a nodata value.
Note that nc_inq_var_fill() does not fill the void *fill_valuep if no_fill=1

Julien


-----Message d'origine-----
De : Even Rouault <even.rouault at spatialys.com> 
Envoyé : mardi 5 novembre 2019 15:48
À : 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 14:08:33 CET Julien Demaria wrote:
> 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.

I'm not sure to understand well this no_fill concept. My understanding is that it is a kind of optimization for the write side. That shouldn't probably affect whether we report a nodata value or not ?

> And in
> creation mode do you confirm that it is not possible to create a 
> variable without nodata value?

Yes, except for byte-like datatypes with the change of my pull request

> 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()?

Not sure to understand the impact of this. I'd let that to you for another pull request.

Even

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


More information about the gdal-dev mailing list