diff --git a/src/metpy/plots/mapping.py b/src/metpy/plots/mapping.py index 0ee2f875388..4f55682e277 100644 --- a/src/metpy/plots/mapping.py +++ b/src/metpy/plots/mapping.py @@ -206,3 +206,14 @@ def make_polar_stereo(attrs_dict, globe): kwargs = CFProjection.build_projection_kwargs(attrs_dict, attr_mapping) return ccrs.Stereographic(globe=globe, **kwargs) + + +@CFProjection.register('rotated_latitude_longitude') +def make_rotated_latlon(attrs_dict, globe): + """Handle rotated latitude/longitude projection.""" + attr_mapping = [('pole_longitude', 'grid_north_pole_longitude'), + ('pole_latitude', 'grid_north_pole_latitude'), + ('central_rotated_longitude', 'north_pole_grid_longitude')] + kwargs = CFProjection.build_projection_kwargs(attrs_dict, attr_mapping) + + return ccrs.RotatedPole(globe=globe, **kwargs) diff --git a/tests/plots/test_mapping.py b/tests/plots/test_mapping.py index 1f476c4291b..8992112b790 100644 --- a/tests/plots/test_mapping.py +++ b/tests/plots/test_mapping.py @@ -241,6 +241,22 @@ def test_polar_stereographic_std_parallel(): assert crs.proj4_params['lat_ts'] == 60 +def test_rotated_latitude_longitude(): + """Test handling a rotated latitude longitude projection.""" + attrs = { + 'grid_mapping_name': 'rotated_latitude_longitude', + 'grid_north_pole_latitude': 36, + 'grid_north_pole_longitude': 65, + 'north_pole_grid_longitude': 0.0, + } + crs = CFProjection(attrs).to_cartopy() + + assert isinstance(crs, ccrs.RotatedPole) + assert crs.proj4_params['o_lon_p'] == 0 + assert crs.proj4_params['o_lat_p'] == 36 + assert crs.proj4_params['lon_0'] == 180 + 65 + + def test_lat_lon(): """Test handling basic lat/lon projection.""" attrs = {'grid_mapping_name': 'latitude_longitude'}