Skip to content
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

Fix custom stereographic domains #141

Merged
merged 2 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/emcpy/plots/create_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,6 @@ def create_figure(self):
"""
Driver method to create figure and subplots.
"""

# Check to make sure plot_list == nrows*ncols
if len(self.plot_list) != self.nrows*self.ncols:
raise ValueError(
Expand Down Expand Up @@ -279,7 +278,6 @@ def create_figure(self):
self.fig = plt.figure(figsize=self.figsize)

for i, plot_obj in enumerate(self.plot_list):

# check if object has projection and domain attributes to determine ax
if hasattr(plot_obj, 'projection'):
# Check if domain object is tuple/list for custom domains
Expand All @@ -301,6 +299,8 @@ def create_figure(self):
lat_formatter = LatitudeFormatter()
ax.xaxis.set_major_formatter(lon_formatter)
ax.yaxis.set_major_formatter(lat_formatter)
else:
ax.set_extent(self.domain.extent, ccrs.PlateCarree())

else:
# Check plot types
Expand Down
10 changes: 2 additions & 8 deletions src/emcpy/plots/map_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,21 +391,15 @@ def _npstereo(self):
Creates projection using Orthographic from Cartopy and
orients it from central latitude 90 degrees.
"""
self.cenlon = 0 if self.cenlon is None else self.cenlon

self.projection = ccrs.Orthographic(central_longitude=self.cenlon,
central_latitude=90,
globe=self.globe)
self.projection = ccrs.NorthPolarStereo(globe=self.globe)
self.transform = ccrs.PlateCarree()

def _spstereo(self):
"""
Creates projection using Orthographic from Cartopy and
orients it from central latitude -90 degrees.
"""
self.cenlon = 0 if self.cenlon is None else self.cenlon

self.projection = ccrs.Orthographic(central_longitude=self.cenlon,
central_latitude=-90,
globe=self.globe)
self.projection = ccrs.SouthPolarStereo(globe=self.globe)
self.transform = ccrs.PlateCarree()
2 changes: 1 addition & 1 deletion src/tests/test_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from scipy.ndimage.filters import gaussian_filter
import matplotlib.pyplot as plt

from emcpy.plots.plots import LinePlot, VerticalLine,\
from emcpy.plots.plots import LinePlot, VerticalLine, \
Histogram, Density, Scatter, HorizontalLine, BarPlot, \
GriddedPlot, ContourPlot, FilledContourPlot, HorizontalBar, \
BoxandWhiskerPlot, HorizontalSpan, SkewT
Expand Down
2 changes: 1 addition & 1 deletion src/tests/test_stats.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from emcpy.stats.stats import mstats, lregress, ttest, get_weights,\
from emcpy.stats.stats import mstats, lregress, ttest, get_weights, \
get_linear_regression, bootstrap, calc_bins
import numpy as np

Expand Down
Loading