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

Matt.Wilkie at yukon.ca Matt.Wilkie at yukon.ca
Wed May 5 14:38:21 PDT 2021


Hi Folks,

I have a 32bit NDVI image that I'm told was exported from Google Earth Engine, with possibly a trip through R along the way. In ArcGIS desktop and Qgis there are "nan" values reported for the image collar, however gdalinfo doesn't say anything about them. If I project the image in gdalwarp the output image contains both nan AND nodata. This is rather confusing.

a) Why does gdalinfo not report the presence of nan? Meaning: how do I know when I will need to invoke (b)?
b) What do I need to do so that applications will use nan as nodata? 

Fig1: Projected output. Pink == nodata, red == 0, black == nan.


Here's the file  https://sft.gov.yk.ca/link/61czGFXOyyFsh387CxbTEF
(255 MB, link valid for 3 months. The image is free and libre.)

Gdalinfo report:

Size is 14742, 6761
Coordinate System is:
GEOGCRS["WGS 84",
    DATUM["World Geodetic System 1984",
        ELLIPSOID["WGS 84",6378137,298.257223563,
            LENGTHUNIT["metre",1]]],
    PRIMEM["Greenwich",0,
        ANGLEUNIT["degree",0.0174532925199433]],
    CS[ellipsoidal,2],
        AXIS["geodetic latitude (Lat)",north,
            ORDER[1],
            ANGLEUNIT["degree",0.0174532925199433]],
        AXIS["geodetic longitude (Lon)",east,
            ORDER[2],
            ANGLEUNIT["degree",0.0174532925199433]],
    ID["EPSG",4326]]
Data axis to CRS axis mapping: 2,1
Origin = (-137.935952550438884,61.086337635411589)
Pixel Size = (0.000269494585236,-0.000269494585236)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  COMPRESSION=LZW
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (-137.9359526,  61.0863376) (137d56' 9.43"W, 61d 5'10.82"N)
Lower Left  (-137.9359526,  59.2642847) (137d56' 9.43"W, 59d15'51.43"N)
Upper Right (-133.9630634,  61.0863376) (133d57'47.03"W, 61d 5'10.82"N)
Lower Right (-133.9630634,  59.2642847) (133d57'47.03"W, 59d15'51.43"N)
Center      (-135.9495080,  60.1753112) (135d56'58.23"W, 60d10'31.12"N)
Band 1 Block=256x256 Type=Float32, ColorInterp=Gray
  Description = NDVI
  Min=-0.888 Max=0.992
  Minimum=-0.888, Maximum=0.992, Mean=0.103, StdDev=0.141
  Overviews: 7371x3381, 3686x1691, 1843x846, 922x423, 461x212
  Metadata:
    STATISTICS_COVARIANCES=0.01992952634076865
    STATISTICS_MAXIMUM=0.9921875
    STATISTICS_MEAN=0.10253506184277
    STATISTICS_MINIMUM=-0.88755017518997
    STATISTICS_SKIPFACTORX=1
    STATISTICS_SKIPFACTORY=1
    STATISTICS_STDDEV=0.14117197434607


Gdalwarp command:

set _opt=-co compress=zstd -co level=17 -co num_threads=all_cpus -co predictor=yes -co bigtiff=yes

gdalwarp -wm 512 %_opt% -of cog -t_srs epsg:3579 -r med NDVI1984.tif t\NDVI1984.tif


GDAL 3.1.4, released 2020/10/20

Thanks!

Matt Wilkie
Geomatics Analyst
Environment | Technology, Innovation and Mapping
T 867-667-8133 | http://yukon.ca/
Hours: 08:30-16:30, Tue-Wed: Office, Thu-Fri: Remote.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: gdalwarp-nan-nodata.jpg
Type: image/jpeg
Size: 36834 bytes
Desc: gdalwarp-nan-nodata.jpg
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20210505/b8ae91ac/attachment-0001.jpg>


More information about the gdal-dev mailing list