[gdal-dev] Units of dimension variable in NetCDF is 'km'

Etienne Tourigny etourigny.dev at gmail.com
Tue Aug 7 04:38:28 PDT 2012


Hi,

km units are supposed to work...

Here is the code where "km" units are detected, which set the WKT
units to 1000m.

            /* add units to PROJCS */
            if ( pszUnits != NULL && ! EQUAL(pszUnits,"") ) {
                if ( EQUAL(pszUnits,"m") ) {
                    oSRS.SetLinearUnits( CF_UNITS_M, 1.0 );
                    oSRS.SetAuthority( "PROJCS|UNIT", "EPSG", 9001 );
                }
                else if ( EQUAL(pszUnits,"km") ) {
                    oSRS.SetLinearUnits( CF_UNITS_M, 1000.0 );
                    oSRS.SetAuthority( "PROJCS|UNIT", "EPSG", 9001 );
                }

What does the wkt actually look like?

Also running gdalinfo --debug ON <file.nc> can give a few hints.

It would be good for you to send me a link to the file or attach it to
a bug report (add me as cc).

Etienne

On Tue, Aug 7, 2012 at 6:10 AM, Anton Korosov <anton.korosov at nersc.no> wrote:
> Dear Etienne,
>
> I faced the following problem with the NetCDF driver:
> Units of the dimension variables are 'km' and values in the SRS are in
> meters, of course (e.g. Earth radius). Hence the calculated GeoTransform is
> 1000 times less than should be and the calculate latlons are incorrect.
> However 'units' attribute is given, besides AFAIK CF-conventions allow to
> have 'k' (kilo) preceding 'm' (meters) in the units.
>
> Can you please give me a hint where to fix that in the driver so that it can
> adequately interpret units of the dimensions?
>
> With best regards!
> Anton
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev


More information about the gdal-dev mailing list