-
Notifications
You must be signed in to change notification settings - Fork 390
Fix stereographic scaling issues #929
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
Conversation
pelson
left a comment
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.
This looks good to me. Probably needs a rebase to get the tests passing. Otherwise, 👍
|
@dopplershift - no doubt you're running around like crazy with AMS, but if you get a chance, I think this just needs a rebase. |
Fixes SciTools#339 and SciTools#455 - added scale_factor to Stereographic projection. - warnings when true_scale_latitude is used with non-polar stereographic projections - test_stereographic extended
4e8253e to
9e4821e
Compare
lib/cartopy/crs.py
Outdated
|
|
||
| class NorthPolarStereo(Stereographic): | ||
| def __init__(self, central_longitude=0.0, globe=None): | ||
| def __init__(self, central_longitude=0.0, true_scale_latitude=None, globe=None): |
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.
E501 line too long (84 > 79 characters)
lib/cartopy/crs.py
Outdated
| central_latitude=90, | ||
| central_longitude=central_longitude, globe=globe) | ||
| central_longitude=central_longitude, | ||
| true_scale_latitude=true_scale_latitude, # None is equivalent to +90 |
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.
E261 at least two spaces before inline comment
E501 line too long (80 > 79 characters)
lib/cartopy/crs.py
Outdated
|
|
||
| class SouthPolarStereo(Stereographic): | ||
| def __init__(self, central_longitude=0.0, globe=None): | ||
| def __init__(self, central_longitude=0.0, true_scale_latitude=None, globe=None): |
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.
E501 line too long (84 > 79 characters)
lib/cartopy/crs.py
Outdated
| central_latitude=-90, | ||
| central_longitude=central_longitude, globe=globe) | ||
| central_longitude=central_longitude, | ||
| true_scale_latitude=true_scale_latitude, # None is equivalent to -90 |
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.
E261 at least two spaces before inline comment
E501 line too long (80 > 79 characters)
|
Done. Yeah, AMS was pretty crazy--but amazing. |
9e4821e to
1af34d7
Compare
lib/cartopy/crs.py
Outdated
| central_latitude=90, | ||
| central_longitude=central_longitude, globe=globe) | ||
| central_longitude=central_longitude, | ||
| true_scale_latitude=true_scale_latitude, # None is +90 |
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.
E261 at least two spaces before inline comment
lib/cartopy/crs.py
Outdated
| central_latitude=-90, | ||
| central_longitude=central_longitude, globe=globe) | ||
| central_longitude=central_longitude, | ||
| true_scale_latitude=true_scale_latitude, # None is -90 |
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.
E261 at least two spaces before inline comment
1af34d7 to
dbdf9b2
Compare
lib/cartopy/crs.py
Outdated
| ('lon_0', central_longitude), | ||
| ('x_0', false_easting), ('y_0', false_northing)] | ||
|
|
||
| if true_scale_latitude: |
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.
It's old, but should this be is not None? Since the *PolarStereo comments say defaults are not 0, it seems like you might want to pass a true scale latitude of 0, and that would be ignored with the code like this. Or is that basically useless since 0 is at the border?
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.
Of course you find that after I think I'm done. 😁 Checking for None makes sense to me since the latitude is float anyway--checking just for 0 is worthless.
|
@pelson How are you going to proceed when the original author never submitted a CLA? |
|
#456 (comment) suggests this was resolved. This is also reflected in https://github.com/SciTools/scitools.org.uk/blob/gh-pages/contributors.json#L36. I'll need to do some digging to figure out why the CLA check is failing. |
1e282c4 to
1405f2e
Compare
|
Alright, finally green (minus CLA). |
pelson
left a comment
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've suggested a few tweaks. But am happy in general with this. thanks @dopplershift 👍
lib/cartopy/crs.py
Outdated
| if true_scale_latitude is not None: | ||
| warnings.warn('It does not make sense to provide both ' | ||
| '"scale_factor" and "true_scale_latitude". ' | ||
| 'Ignoring "scale_factor".') |
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've just realised that this is new behaviour - I'd support this being an exception, not a warning.
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.
Makes sense.
lib/cartopy/crs.py
Outdated
| 'the use of "scale_factor" instead.') | ||
| proj4_params.append(('lat_ts', true_scale_latitude)) | ||
|
|
||
| if scale_factor: |
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'd be more comfortable if we checked None explicitly. (I know scale_factor=0 doesn't really make any sense, but I'd rather not ignore it silently.)
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.
Sure.
1405f2e to
da433a5
Compare
QuLogic
left a comment
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.
Assuming @pelson can figure out the CLA.
|
Ping @pelson? Last thing for 0.16... |
|
Just looks like the ID used to make the commit is not the same as the Github username. Can either get the original author to make the association to please the CI tool, or just take it that this commit obviously came from that person who we have a CLA for. |
|
Well, I'm merging this then. |
This picks back up #456 and fixes #339 and #455
scale_factortoStereographicprojection.true_scale_latitudeis used with non-polarstereographic projections
test_stereographicextendedcc @QuLogic since you reviewed this previously