[gdal-dev] NetCDF driver getting wrong values if compared to HDF5

Even Rouault even.rouault at spatialys.com
Fri Aug 2 08:54:56 PDT 2019


On vendredi 2 août 2019 14:44:02 CEST Ivan Lucena wrote:
> Even,
> 
> The metadata of one file samples points to
> http://land.copernicus.eu/global/products/ndvi
> 
> I wasn't able to recover my username/password so I not sure what is there.
> 
> Another this page you can select the specific product I am using 1KM Decadal
> NDVI but without login in I can tell if it is going to download the .nc
> file:
> 
> https://land.copernicus.vgt.vito.be/PDF/portal/Application.html#Browse;Root=
> 513186;Collection=1000085;DoSearch=true;Time=NORMAL,NORMAL,1,APRIL,1998,2,AU
> GUST,2019
> 
> Can you give it a try?
> 

OK, this is due to the fact that the netCDF driver is doing a special 
processing with the valid_range metadata item. It will set pixel values 
outside of the range defined by valid_range to the nodata value.
This can be disabled by the HONOUR_VALID_RANGE=NO open option.
Generally, as expected, the netCDF driver will have more particular behaviour 
when dealing with netCDF files than the HDF5 driver (the HDF5 driver has been 
enhanced over years to take into account a few netCDF specific metadata items, 
but not that one)

> Note, netCDF return this "Lower Right ( 179.9955357, -59.9955357)
> (179d59'43.93"E, 59d59'43.93"S)" while the documentation mention exact "
> Polygon
> -60 180 80 180 80 -180 -60 -180 -60 180". It looks like a half pixel
> difference, do you see a problem with that?

No, if you look at the actual range with ncdump for longitude, you'll get

lon = -180, -179.991071428571, [...]
    179.982142857634, 179.991071429063 ;

and GDAL normalizes the netCDF pixel-center convention to its usual pixel-
corner convention.

Even

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


More information about the gdal-dev mailing list