[GRASS-user] Cannot read NetCDF with 'semi_major_axis' or 'inverse_flattening'

Ken Mankoff mankoff at gmail.com
Fri Jul 23 10:32:42 PDT 2021


Hello list,

I have been given an updated NetCDF file - everything is the same as the old version except there are two new attributes in the 'mapping' variable:

        char mapping ;
                mapping:geoid = "eigen-6c4" ;
                mapping:grid_mapping_name = "polar_stereographic" ;
                mapping:latitude_of_projection_origin = 90. ;
                mapping:standard_parallel = 70. ;
                mapping:straight_vertical_longitude_from_pole = -45. ;
                mapping:semi_major_axis = 6378273. ;
                mapping:inverse_flattening = 298.27940504282 ;
                mapping:false_easting = 0. ;
                mapping:false_northing = 0. ;
                mapping:_Storage = "contiguous" ;


Specifically:
                mapping:semi_major_axis = 6378273. ;
                mapping:inverse_flattening = 298.27940504282 ;

When I try to load this file with:

r.external source=netCDF:file.nc:surface output=surface

I get this error:

WARNING: Datum <unnamed> not recognised by GRASS and no parameters found
ERROR: Projection of dataset does not appear to match current location.

Location PROJ_INFO is:
name: WGS 84 / NSIDC Sea Ice Polar Stereographic North
datum: wgs84
ellps: wgs84
proj: stere
lat_0: 90
lat_ts: 70
lon_0: -45
x_0: 0
y_0: 0
no_defs: defined
init: EPSG:3413

Dataset PROJ_INFO is:
name: unnamed
a: 6378273
es: 0.006693883000000017
proj: stere
lat_0: 90
lat_ts: 70
lon_0: -45
x_0: 0
y_0: 0
no_defs: defined

ERROR: datum

In case of no significant differences in the projection definitions, use the -o flag to ignore them and use current location definition.
Consider generating a new location from the input dataset using the 'location' parameter.


If I remove thos two attributes (semi_major_axis and inverse_flattening) with:

ncatted -O -h -a semi_major_axis,mapping,d,l,6378273 -a inverse_flattening,mapping,d,f,298.27940504282 file.nc foo.nc

And then try to read in the data, it works.

Is there some reason that those two attributes make it difficult to load the data in GRASS? Is there a better work-around than removing them? The documented projection of the data has not changed, only some of the metadata.

Versions:
gdal 3.0.4
grass 7.8.2

Thank you,

   -k.



More information about the grass-user mailing list