From 4320782a08327d98f1dd212df1b1ce5b385d958c Mon Sep 17 00:00:00 2001 From: Kevin Dougherty Date: Thu, 30 May 2024 14:00:52 +0000 Subject: [PATCH 1/2] updates to fix custom np/sp stereo plots --- src/emcpy/plots/create_plots.py | 4 ++-- src/emcpy/plots/map_tools.py | 10 ++-------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/emcpy/plots/create_plots.py b/src/emcpy/plots/create_plots.py index 0dd9e009..df755e6b 100644 --- a/src/emcpy/plots/create_plots.py +++ b/src/emcpy/plots/create_plots.py @@ -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( @@ -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 @@ -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 diff --git a/src/emcpy/plots/map_tools.py b/src/emcpy/plots/map_tools.py index 52f2b771..7275ef63 100644 --- a/src/emcpy/plots/map_tools.py +++ b/src/emcpy/plots/map_tools.py @@ -391,11 +391,8 @@ 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): @@ -403,9 +400,6 @@ 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() From be31942327676002180efb77832066651a35e7d6 Mon Sep 17 00:00:00 2001 From: Kevin Dougherty Date: Thu, 30 May 2024 14:08:18 +0000 Subject: [PATCH 2/2] fixed files that were not passing pycodestyle tests --- src/tests/test_plots.py | 2 +- src/tests/test_stats.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tests/test_plots.py b/src/tests/test_plots.py index 856f1e2d..240593d9 100644 --- a/src/tests/test_plots.py +++ b/src/tests/test_plots.py @@ -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 diff --git a/src/tests/test_stats.py b/src/tests/test_stats.py index 8f47b3d8..8db61692 100644 --- a/src/tests/test_stats.py +++ b/src/tests/test_stats.py @@ -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