Closed pnuu closed 9 months ago
All modified and coverable lines are covered by tests :white_check_mark:
Comparison is base (
e82bf47
) 94.06% compared to head (c9b9787
) 94.23%. Report is 82 commits behind head on main.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
How about using pyproj's crs.to_cf()
as a first guess instead of catching the warning?
Here's an example output:
In [27]: crs.to_cf()
Out[27]:
{'crs_wkt': 'PROJCRS["unknown",BASEGEOGCRS["unknown",DATUM["Unknown based on WGS 84 ellipsoid",ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1],ID["EPSG",7030]]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8901]]],CONVERSION["unknown",METHOD["Polar Stereographic (variant B)",ID["EPSG",9829]],PARAMETER["Latitude of standard parallel",60,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8832]],PARAMETER["Longitude of origin",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8833]],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)",south,MERIDIAN[90,ANGLEUNIT["degree",0.0174532925199433,ID["EPSG",9122]]],ORDER[1],LENGTHUNIT["metre",1,ID["EPSG",9001]]],AXIS["(N)",south,MERIDIAN[180,ANGLEUNIT["degree",0.0174532925199433,ID["EPSG",9122]]],ORDER[2],LENGTHUNIT["metre",1,ID["EPSG",9001]]]]',
'semi_major_axis': 6378137.0,
'semi_minor_axis': 6356752.314245179,
'inverse_flattening': 298.257223563,
'reference_ellipsoid_name': 'WGS 84',
'longitude_of_prime_meridian': 0.0,
'prime_meridian_name': 'Greenwich',
'geographic_crs_name': 'unknown',
'horizontal_datum_name': 'Unknown based on WGS 84 ellipsoid',
'projected_crs_name': 'unknown',
'grid_mapping_name': 'polar_stereographic',
'standard_parallel': 60.0,
'straight_vertical_longitude_from_pole': 0.0,
'false_easting': 0.0,
'false_northing': 0.0}
Oh, that's much better! I tried looking at the methods if any of them provided the needed information. I'll adjust in a bit.
There is a utility context manager function in some utils module that does this. I use it in geometry.py and other places. I think i left this bit of the CF code because I was hoping we could use the CRS object directly.
This PR removes a warning when getting actual projection details that are needed for CF by using
to_cf()
instead ofto_dict()
. This is part of Satpy reader cleanup started in https://github.com/pytroll/satpy/pull/2689