-
Notifications
You must be signed in to change notification settings - Fork 215
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
added CRS mapping to/from CF 1.8; added to_proj4_dict #244
Conversation
|
I am learning towards |
@snowman2 This is amazing. I think some good people to look at this would be @dopplershift, @mraspaud, and @pnuu. I'll try to find time to review this in the next couple days. |
8b05459
to
83e1bee
Compare
Looks good. I just wonder if a warning should be issued if a parameter doesn't map to CF (instead of silently ignoring them). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had a couple questions that I commented on specifically. Otherwise, my other question is whether it would be better to not copy the in_cf
dictionary in from_cf
but rather let KeyErrors handle the pop
'd keys in the final for loop.
Again, this is great.
The popping was from another iteration where I was rasing an exception when a parameter didn't match. I think @jswhit has a valid point about warning the user. If we do warn the user, the current copy/pop implementation should stay. If not, it can be changed. I added warnings in the docs, but those aren't always read. So, putting it in the code will make it more likely that the user will notice. |
It seems there is a warning raised almost every single time the function
That is kind of annoying, but good to know as well. So, I am not sure how I feel about it. Thoughts? |
My initial reaction is to mark certain parameters as "can't be converted" by storing them with Side note: You can remove the |
I like the idea of having a separate exclusions list in there for known skipped PROJ params. I think having this could also allow users to lookup which params are not supported by CF. It would probably also be good to have a separate one for known CF parameters not supported by PROJ. I think raising a warning for parameters not in either of those lists would be useful. But, open to opinions. Another question in my mind is: Would it be better to only ignore parameters such as "nodefs" & "type" and warn for other ones such as "zone" or "k"?
That's neat. When was the feature introduced? |
Or, we could follow the current method in |
I'm interested in the idea of ignoring for some, warning for others. I could see it being a fine line though. I like the idea of an option for the user too. For the |
I am leaning towards the
Ahhh, makes sense now. Thanks for the clarification :) |
I was talking with @mraspaud about this and he pointed out the differences in oblique mercator handling. We had been using "alpha" instead of "gamma" for "azimuth_of_central_line". Also, we are using "lonc" for "longitude_of_projection_origin". Any idea if these can or should be used? https://github.com/pytroll/satpy/blob/master/satpy/writers/cf_writer.py#L39-L55 |
Thanks for bringing those points up. I am not entirely sure, so I will give my reasoning for my decisions and hopefully they will help choose which way to go on this. If you wouldn't mind sharing your reasoning, that would be helpful as well. azimuth_of_central_lineOkay, for
From the oblique mercator docs here: https://proj4.org/operations/projections/omerc.html +gamma
+alpha
longitude_of_projection_originFor the |
Looks like y'all are using |
Also looks like |
According to https://proj4.org/operations/projections/omerc.html#cmdoption-arg-lonc I'll let @mraspaud respond to the alpha versus gamma question. Not sure he has a ton of time though. |
From reading the docs you posted:
It seems similar to the way the CF version is implementing it, so it sounds like the way you have it is the correct way. |
@mraspaud said we wanted geotiff compatibility so he was looking at this page: http://geotiff.maptools.org/proj_list/hotine_oblique_mercator.html |
@snowman2 sorry for coming in late on this one! So as @djhoese said, geotiff was the priority, and in the documentation they mention |
@painter1, we are working on mapping the CF parameters to PROJ parameters and would appreciate it if you could clarify our questions about |
Looking at the PROJ code here, it seems like |
Recent changes look good to me. Thanks. |
Thanks for the review @djhoese, you had some good points/catches. |
@jswhit are your concerns about warning the user resolved with the current implementation? |
Yes - that looks good to me. |
Update: I am now very confident that >>> from pyproj import CRS
>>> crs = CRS({
... "proj": "omerc",
... "lat_0": 10,
... "lonc": 15,
... "alpha": 0.35,
... "gamma": 0.55,
... "k": 1,
... "x_0": 0,
... "y_0": 0,
... "ellps": "WGS84",
... "units": "m",
... "no_defs": None,
... "type": "crs",
... })
>>> crs.coordinate_operation
CONVERSION["unknown",
METHOD["Hotine Oblique Mercator (variant B)",
ID["EPSG",9815]],
PARAMETER["Latitude of projection centre",10,
ANGLEUNIT["degree",0.0174532925199433],
ID["EPSG",8811]],
PARAMETER["Longitude of projection centre",15,
ANGLEUNIT["degree",0.0174532925199433],
ID["EPSG",8812]],
PARAMETER["Azimuth of initial line",0.35,
ANGLEUNIT["degree",0.0174532925199433],
ID["EPSG",8813]],
PARAMETER["Angle from Rectified to Skew Grid",0.55,
ANGLEUNIT["degree",0.0174532925199433],
ID["EPSG",8814]],
PARAMETER["Scale factor on initial line",1,
SCALEUNIT["unity",1],
ID["EPSG",8815]],
PARAMETER["Easting at projection centre",0,
LENGTHUNIT["metre",1],
ID["EPSG",8816]],
PARAMETER["Northing at projection centre",0,
LENGTHUNIT["metre",1],
ID["EPSG",8817]]]
>>> crs = CRS({
... "proj": "omerc",
... "lat_0": 10,
... "lon_0": 15,
... "alpha": 0.35,
... "gamma": 0.35,
... "k": 1,
... "x_0": 0,
... "y_0": 0,
... "ellps": "WGS84",
... "units": "m",
... "no_defs": None,
... "type": "crs",
... })
>>> crs.coordinate_operation
CONVERSION["unknown",
METHOD["Hotine Oblique Mercator (variant B)",
ID["EPSG",9815]],
PARAMETER["Latitude of projection centre",10,
ANGLEUNIT["degree",0.0174532925199433],
ID["EPSG",8811]],
PARAMETER["Longitude of projection centre",0,
ANGLEUNIT["degree",0.0174532925199433],
ID["EPSG",8812]],
PARAMETER["Azimuth of initial line",0.35,
ANGLEUNIT["degree",0.0174532925199433],
ID["EPSG",8813]],
PARAMETER["Angle from Rectified to Skew Grid",0.35,
ANGLEUNIT["degree",0.0174532925199433],
ID["EPSG",8814]],
PARAMETER["Scale factor on initial line",1,
SCALEUNIT["unity",1],
ID["EPSG",8815]],
PARAMETER["Easting at projection centre",0,
LENGTHUNIT["metre",1],
ID["EPSG",8816]],
PARAMETER["Northing at projection centre",0,
LENGTHUNIT["metre",1],
ID["EPSG",8817]]] |
Addresses #226
This will need a good review.
I am unsure about what the CF
unit
mapped to. It is eitherunits
orvunits
. I am guessingvunits
at the moment, but it is only a guess.Others I think are just another maping to
datum
, but not sure. Maybe there is avdatum
in PROJ I am missing.