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

Stefan Blumentrath Stefan.Blumentrath at nina.no
Sat Jul 24 14:19:40 PDT 2021


Hei Ken,

Did you try the -o flag ("Override projection check (use current location's projection)
Assume that the dataset has same projection as the current location")?
https://grass.osgeo.org/grass78/manuals/r.external.html
As the error message suggests?

If you are sure that projections in fact match, a mismatch in CRS description can be overridden that way, without modifying the input file.

Alternatively, you can use r.import to reproject while converting to GRASS format or you create a new location...

Cheers
Stefan


-----Original Message-----
From: grass-user <grass-user-bounces at lists.osgeo.org> On Behalf Of Ken Mankoff
Sent: fredag 23. juli 2021 19:33
To: GRASS user list <grass-user at lists.osgeo.org>
Subject: [GRASS-user] Cannot read NetCDF with 'semi_major_axis' or 'inverse_flattening'

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.

_______________________________________________
grass-user mailing list
grass-user at lists.osgeo.org
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.osgeo.org%2Fmailman%2Flistinfo%2Fgrass-user&data=04%7C01%7C%7C900b853648c545edd6fd08d94dffe4cb%7C6cef373021314901831055b3abf02c73%7C0%7C0%7C637626583719044920%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=wWKyBuAKwbuobSGVQ6q97VXj1OIiCLSN9NlbXDLw7tc%3D&reserved=0


More information about the grass-user mailing list