-
Notifications
You must be signed in to change notification settings - Fork 216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unexpected geostationary CF conversion #515
Comments
Similarly, if you provide the datum/ellps then the resulting CF has |
@djhoese, the current version of from CF and to CF are definitely imperfect. It is entirely based on the output of If you look at the output of the WKT in both examples, it has all of that information included. I have plans to change this in version 2.5 to be based on the WKT form in import/export as it is more complete. See: https://pyproj4.github.io/pyproj/latest/build_crs.html |
Interesting. That makes a lot of sense. As for the how to build a CRS in pyproj 2.5, it makes me a little scared. I'm sure it is more accurate and flexible to specify things one at a time and define each portion (ellipsoid, datum, conversion, etc), but it seems really complicated. I suppose as long as there are some helper functions for converting between things it shouldn't be too bad. |
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. |
Awesome! Thanks @snowman2! |
Not a problem 👍. If you wouldn't mind giving it a test drive sometime, that would be helpful to iron out some bugs. |
I tried my original example from above and get an error for both cases:
|
Ha - I had a geostationary test and thought that was good. I guess I should have tried your specific example 🙃. Thanks for trying it out 👍. Will add a fix later. |
@djhoese, I don't see And when I do
However, it is mentioned for the geostationary projection for CF: And it currently works with how I have it setup if you use the CF form: >>> crs = CRS.from_cf(
... dict(
... grid_mapping_name="geostationary",
... perspective_point_height=1,
... fixed_angle_axis="y",
... )
... )
>>> print(crs.coordinate_operation.to_wkt(pretty=True))
CONVERSION["unknown",
METHOD["Geostationary Satellite (Sweep X)"],
PARAMETER["Satellite height",1,
LENGTHUNIT["metre",1,
ID["EPSG",9001]]],
PARAMETER["Latitude of natural origin",0,
ANGLEUNIT["degree",0.0174532925199433],
ID["EPSG",8801]],
PARAMETER["Longitude of natural origin",0,
ANGLEUNIT["degree",0.0174532925199433],
ID["EPSG",8802]],
PARAMETER["False easting",0,
LENGTHUNIT["metre",1],
ID["EPSG",8806]],
PARAMETER["False northing",0,
LENGTHUNIT["metre",1],
ID["EPSG",8807]]]
>>> crs.to_proj4()
'+proj=geos +sweep=x +lon_0=0 +h=1 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs +type=crs' So, I think leaving it in its current form where it will throw an exception is safer because it drops the >>> crs = CRS(
... {"proj": "geos", "h": 35785831.0, "a": 6378169.0, "b": 6356583.8, "lat_0": 1}
... )
>>> crs.to_proj4()
'+proj=geos +h=35785831.0 +a=6378169.0 +b=6356583.8 +lat_0=1 +type=crs'
>>> print(crs.coordinate_operation.to_wkt(pretty=True))
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]]] I am going to re-open this issue and see what the PROJ devs have to say about it. |
It also seems to be lost in the coordinate operation PROJ string: >>> crs.coordinate_operation.to_proj4()
'+proj=pipeline +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=geos +lon_0=0 +h=35785831 +x_0=0 +y_0=0 +a=6378169 +b=6356583.8' |
Forwarded to: OSGeo/PROJ#1930 |
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 |
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
Problem description
As seen in the output above, when
lon_0
andlat_0
are missing in the PROJ definition,to_cf
is providing a defaultlongitude_of_projection_origin
,false_easting
, andfalse_northing
, but nolatitude_of_projection_origin
(default of 0). When we add alat_0
parameter thelongitude_of_projection_origin
,false_easting
, andfalse_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 aboutsweep_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.
The text was updated successfully, but these errors were encountered: