-
Notifications
You must be signed in to change notification settings - Fork 370
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 winkel tripel projection class #2442
base: main
Are you sure you want to change the base?
Conversation
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.
Nice, this looks like a great start.
Regarding the tests: Probably add a test similar to one of the other crs's here containing some transform points and initialization expectations: https://github.com/SciTools/cartopy/tree/main/lib/cartopy/tests/crs
Add the projection to the parameterization list here and add a comparison image.
cartopy/lib/cartopy/tests/mpl/test_mpl_integration.py
Lines 161 to 200 in d57fa13
@pytest.mark.parametrize('proj', [ | |
ccrs.Aitoff, | |
ccrs.EckertI, | |
ccrs.EckertII, | |
ccrs.EckertIII, | |
ccrs.EckertIV, | |
ccrs.EckertV, | |
ccrs.EckertVI, | |
ccrs.EqualEarth, | |
ccrs.Gnomonic, | |
ccrs.Hammer, | |
pytest.param((ccrs.InterruptedGoodeHomolosine, dict(emphasis='land')), | |
id='InterruptedGoodeHomolosine'), | |
ccrs.LambertCylindrical, | |
pytest.param((ccrs.Mercator, dict(min_latitude=-85, max_latitude=85)), | |
id='Mercator'), | |
ccrs.Miller, | |
ccrs.Mollweide, | |
ccrs.NorthPolarStereo, | |
ccrs.Orthographic, | |
pytest.param((ccrs.OSGB, dict(approx=True)), id='OSGB'), | |
ccrs.PlateCarree, | |
ccrs.Robinson, | |
pytest.param((ccrs.RotatedPole, | |
dict(pole_latitude=45, pole_longitude=180)), | |
id='RotatedPole'), | |
ccrs.Stereographic, | |
ccrs.SouthPolarStereo, | |
pytest.param((ccrs.TransverseMercator, dict(approx=True)), | |
id='TransverseMercator'), | |
pytest.param( | |
(ccrs.ObliqueMercator, dict(azimuth=0.)), id='ObliqueMercator_default' | |
), | |
pytest.param( | |
(ccrs.ObliqueMercator, dict(azimuth=90., central_latitude=-22)), | |
id='ObliqueMercator_rotated', | |
), | |
]) | |
@pytest.mark.mpl_image_compare(style='mpl20') | |
def test_global_map(proj): |
A PR you can look at for updating one of the other projections is #1561
globe = globe or Globe(semimajor_axis=WGS84_SEMIMAJOR_AXIS) | ||
proj4_params = [('proj', 'wintri'), | ||
('lon_0', central_longitude), | ||
('lat_0', 0.0)] |
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.
Do we need to pass in the lat_0
parameter even if 0 is the default, and does that even work, it looks like it is lat_1
in the documentation: https://proj.org/en/9.4/operations/projections/wintri.html
@@ -2493,6 +2493,33 @@ def transform_points(self, src_crs, x, y, z=None, trap=False): | |||
return result | |||
|
|||
|
|||
class WinkelTripel(_WarpedRectangularProjection): |
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.
Do we need to do any of the nan handling here like we are doing in the Robinson projection? i.e. should this subclass Robinson
instead if it is similar to that?
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 was able to generate maps containing maps with no problem. Are there other tests for nans that I would need to do?
Co-authored-by: Greg Lucas <[email protected]>
Rationale
Winkel-Tripel is a popular projection that would be used by multiple users (my group at UT and folks at NCAR). It is also the primary projection for the National Geographic Society.
Implications
I have created a new CRS projection object without modifying any code by utilizing existing class objects and the pyproj backend.
Checklist
This is my first pull request! I am open to input how on to properly contribute.