[gdal-dev] Netcdf coordinates swapped

Even Rouault even.rouault at spatialys.com
Fri Oct 12 04:16:09 PDT 2018


On vendredi 12 octobre 2018 11:36:53 CEST Andre Joost wrote:
> Dear list,
> 
> can anybody give some insight on this netcdf file:
> 
>   https://github.com/Andre-J/testing/raw/master/3A-DAY.nc
> 
> ncdump reports:
> 
> netcdf \3a-day {
> dimensions:
> 	AD = 2 ;
> 	chn = 2 ;
> 	nlon = 1440 ;
> 	nlat = 536 ;
> 
> and Panoply displays it fine, but gdal_translate swaps the coordinates,
> returning a 536x1440 raster.

Actually, letting aside the geographic semantics and only reasoning in term of 
image/cube, this is a width=536xheight=1440 raster since the fastest varying 
dimension is the last one in the following declaration, that is nlat

        float precipRateNearSurfMean(AD, chn, nlon, nlat) ;

So if you want to present it with rows in GDAL raster = values at same 
latitude, you would need to flip it diagonaly, which is generally inefficient 
for large rasters since that goes against the natural data organization in the 
file.

> 
> Is there any NCO or GDAL option to sanitize the axes? 

Can't say for NCO, but not in GDAL. Would require a specific development to 
handle such dataset that doesn't follow the usual CF conventions.

You could possibly use numpy to do the matrix transposition.

Even

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


More information about the gdal-dev mailing list