question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unexpected geostationary CF conversion

See original GitHub issue

Code 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:closed
  • Created 4 years ago
  • Comments:13 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
snowman2commented, Jan 24, 2020

As for the how to build a CRS in pyproj 2.5, it makes me a little scared.

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.

0reactions
djhoesecommented, Feb 13, 2020

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Articles - Biogeosciences
We review a number of existing applications that use data from geostationary platforms and present upcoming opportunities for observing key ecosystem properties ...
Read more >
Assimilation of radiance observations from geostationary ...
ECMWF system, along with other satellites in the geostationary ring. ... is consistent with the number of channels assimilated from each (c.f. Table...
Read more >
Research Applications for the Geostationary Lightning Mapper ...
This is accomplished by converting floating point numbers into short integers with scale factors and offsets that adhere to the NetCDF Climate and...
Read more >
Support - CDO - Project Management Service
convert /remap curvilinear grid to regular grid CORDEX data · Polina Franke, 2022-02-14 17:53 ; Remapdis - Weighted average calculation for multiple single...
Read more >
Bin-averaged CF at high ( c H , solid gray lines) and ... - ResearchGate
The launch of the Geostationary Earth Radiation Budget (GERB) instrument ... Nevertheless, because of the improved NB-to-BB conversion, the asymmetry ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found