Unexpected geostationary CF conversion
See original GitHub issueCode Sample, a copy-pastable example if possible
A “Minimal, Complete and Verifiable Example” will make it much easier for maintainers to help you: http://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports
from pyproj import CRS
a = 6378169.
b = 6356583.8
h = 35785831.
CRS.from_dict({'proj': 'geos', 'h': h, 'a': a, 'b': b}).to_cf()
# Output
{'crs_wkt': 'PROJCRS["unknown",BASEGEOGCRS["unknown",DATUM["unknown",ELLIPSOID["unknown",6378169,295.488065897001,LENGTHUNIT["metre",1,ID["EPSG",9001]]]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8901]]],CONVERSION["unknown",METHOD["Geostationary Satellite (Sweep Y)"],PARAMETER["Longitude of natural origin",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8802]],PARAMETER["Satellite Height",35785831,LENGTHUNIT["metre",1,ID["EPSG",9001]]],PARAMETER["False easting",0,LENGTHUNIT["metre",1],ID["EPSG",8806]],PARAMETER["False northing",0,LENGTHUNIT["metre",1],ID["EPSG",8807]]],CS[Cartesian,2],AXIS["(E)",east,ORDER[1],LENGTHUNIT["metre",1,ID["EPSG",9001]]],AXIS["(N)",north,ORDER[2],LENGTHUNIT["metre",1,ID["EPSG",9001]]]]',
'grid_mapping_name': 'geostationary',
'longitude_of_projection_origin': 0,
'perspective_point_height': 35785831,
'false_easting': 0,
'false_northing': 0,
'semi_major_axis': 6378169,
'semi_minor_axis': 6356583.8,
'unit': 'm'}
CRS.from_dict({'proj': 'geos', 'h': h, 'a': a, 'b': b, 'lat_0': 0}).to_cf()
# Output
{'crs_wkt': 'PROJCRS["unknown",BASEGEOGCRS["unknown",DATUM["unknown",ELLIPSOID["unknown",6378169,295.488065897001,LENGTHUNIT["metre",1,ID["EPSG",9001]]]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8901]]],CONVERSION["unknown",METHOD["Geostationary Satellite (Sweep Y)"],PARAMETER["Longitude of natural origin",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8802]],PARAMETER["Satellite Height",35785831,LENGTHUNIT["metre",1,ID["EPSG",9001]]],PARAMETER["False easting",0,LENGTHUNIT["metre",1],ID["EPSG",8806]],PARAMETER["False northing",0,LENGTHUNIT["metre",1],ID["EPSG",8807]]],CS[Cartesian,2],AXIS["(E)",east,ORDER[1],LENGTHUNIT["metre",1,ID["EPSG",9001]]],AXIS["(N)",north,ORDER[2],LENGTHUNIT["metre",1,ID["EPSG",9001]]]]',
'grid_mapping_name': 'geostationary',
'perspective_point_height': 35785831.0,
'semi_major_axis': 6378169.0,
'semi_minor_axis': 6356583.8,
'latitude_of_projection_origin': 0}
Problem description
As seen in the output above, when lon_0
and lat_0
are missing in the PROJ definition, to_cf
is providing a default longitude_of_projection_origin
, false_easting
, and false_northing
, but no latitude_of_projection_origin
(default of 0). When we add a lat_0
parameter the longitude_of_projection_origin
, false_easting
, and false_northing
are removed.
Expected Output
I’m not sure. It is not completely unreasonable to me that a descriptive PROJ description has to be provided to get the related CF attributes to come out on the other end. However, there are some parameters for CF that are missing if they are not provided and have known defaults. That said, I understand with the way the CF conversion is implemented there is no way to know how to convert a parameter that doesn’t exist.
Any idea if CF considers parameters like latitude_of_projection_origin
optional? What about sweep_angle_axis
? I didn’t see a mention of them as being optional in the CF spec. Maybe they should be?
Just wanted to point this all out in case it was unexpected for you.
Issue Analytics
- State:
- Created 4 years ago
- Comments:13 (13 by maintainers)
The good news is that it is not the only way to build a CRS. The new methods are there to give users more options when creating a CRS.
Thanks! My examples above don’t raise an error any more. I have a pull request in Satpy to switch our “CF” writer to use pyproj for all the projection conversions. That will be the real test for all of this functionality. @mraspaud, if you could use the pyproj master branch with converting some of your
omerc
projections that would be a good test.