diff --git a/pymistral/plot.py b/pymistral/plot.py index e87439216ac9a00ac20803a39f456b84e700933b..8b90ea1fde539ba800f251459746e6d3c5571a3a 100644 --- a/pymistral/plot.py +++ b/pymistral/plot.py @@ -137,8 +137,8 @@ class CartopyMap(object): print( 'use stereo maps and facet plots by:', ' fig,ax=plt.subplots(subplot_kw=', - f'{"projection":ccrs.NorthPolarStereo()}\n', - 'd.isel(time=0).plot_map(proj=proj,ax=ax)' + '{"projection":ccrs.NorthPolarStereo()}\n', + 'd.isel(time=0).plot_map(proj=proj,ax=ax)', ) if single_plot: axm = getattr(xda.plot, plot_type)( @@ -159,6 +159,15 @@ class CartopyMap(object): else: if round: ax.set_boundary(circle, transform=ax.transAxes) + max_lat = 30 + if isinstance(proj, ccrs.NorthPolarStereo): + ax.set_extent( + [-180, 180, max_lat, 90], crs=ccrs.PlateCarree() + ) + elif isinstance(proj, ccrs.SouthPolarStereo): + ax.set_extent( + [-180, 180, -90, -max_lat], crs=ccrs.PlateCarree() + ) axm = getattr(xda.plot, plot_type)( lon, lat, ax=ax, transform=ccrs.PlateCarree(), **kwargs ) diff --git a/pymistral/tests/test_plot.py b/pymistral/tests/test_plot.py index 89ee8057badacee647e03b5cf79090ac01e36348..2e94ca2a66393579456758d2839535fc1902c555 100644 --- a/pymistral/tests/test_plot.py +++ b/pymistral/tests/test_plot.py @@ -60,7 +60,8 @@ def test_plot_map_projstr(da, projstr): pytest.lazy_fixture('air_temperature_da'), ], ) -@pytest.mark.parametrize('projstr', ['NorthPolarStereo']) +@pytest.mark.parametrize('projstr', ['NorthPolarStereo','SouthPolarStereo','Stereographic']) def test_plot_map_stereo(da, projstr): - fig, ax = plt.subplots(subplot_kw={'projection': ccrs.NorthPolarStereo()}) + proj = eval(f'ccrs.{projstr}()') + fig, ax = plt.subplots(subplot_kw={'projection': proj}) da.isel(time=0).plot_map(proj=projstr, ax=ax)