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

Etienne Tourigny etourigny.dev at gmail.com
Tue Aug 7 07:02:31 PDT 2012


Hi Kyle,

Anton identified the problem, the driver assume that x dimension is
named "x", and in his dataset it is named "xc".  The fix you refer to
probably would not work in this case either.

Etienne

On Tue, Aug 7, 2012 at 10:59 AM, Kyle Shannon <kyle at pobox.com> wrote:
> What version are you using?  I seem to remember something like this in a
> ticket I filed.  I thought it was fixed in 1.9.1.
>
> kss
>
> On Tue, Aug 7, 2012 at 5:38 AM, Etienne Tourigny <etourigny.dev at gmail.com>
> wrote:
>>
>> 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
>> _______________________________________________
>> 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