[gdal-dev] Gdal doesn't see NaN values as NoData?

Even Rouault even.rouault at spatialys.com
Wed May 5 14:49:20 PDT 2021


> a) Why does gdalinfo not report the presence of nan? Meaning: how do I know when I will need to invoke (b)?
It doesn't report nan as the nodata value, because the file lacks the 
GDAL_NODATA tiff tag set at "nan". So the issue is on the producer side.
> b) What do I need to do so that applications will use nan as nodata?

gdalwarp -dstnodata nan ...

or if you want to remap nan to some other value

gdalwarp -dstnodata -9999 ...

In most cases, you'd need to explicitly add the srcnodata value with 
-srcnodata nan , but nan is a special case. When gdalwarp finds a pixel 
at NaN value, be it the declared nodata value or not, it assumes this is 
nodata, hence you can omit -srcnodata nan. Wouldn't be true if 0 or some 
other value was the undeclared nodata  value.

I've some doubt that it is produced by GEE. Seems move to come from Esri 
software seeing:

$ tiffinfo NDVI1984.tif

   Tag 42112: <GDALMetadata>
   <Item name="PyramidResamplingType" domain="Esri">NEAREST</Item>
   <Item name="DESCRIPTION" sample="0" role="description">NDVI</Item>



My software is free, but my time generally not.

More information about the gdal-dev mailing list