diff --git a/act/plotting/WindRoseDisplay.py b/act/plotting/WindRoseDisplay.py index 6def14d1d2..5ea0c76e88 100644 --- a/act/plotting/WindRoseDisplay.py +++ b/act/plotting/WindRoseDisplay.py @@ -83,6 +83,7 @@ def set_rrng(self, rrng, subplot_index=(0,)): def plot(self, dir_field, spd_field, dsname=None, subplot_index=(0,), cmap=None, set_title=None, num_dirs=20, spd_bins=None, tick_interval=3, legend_loc=0, legend_bbox=None, legend_title=None, + calm_threshold=1., **kwargs): """ Makes the wind rose plot from the given dataset. @@ -114,6 +115,8 @@ def plot(self, dir_field, spd_field, dsname=None, subplot_index=(0,), Legend bounding box coordinates legend_title : string Legend title + calm_threshold : float + Winds below this threshold are considered to be calm. **kwargs : keyword arguments Additional keyword arguments will be passed into :func:plt.bar @@ -200,6 +203,11 @@ def plot(self, dir_field, spd_field, dsname=None, subplot_index=(0,), self.axes[subplot_index].set_theta_zero_location("N") self.axes[subplot_index].set_theta_direction(-1) + # Add an annulus with text stating % of time calm + pct_calm = np.sum(spd_data <= calm_threshold) / len(spd_data) * 100 + self.axes[subplot_index].set_rorigin(-2.5) + self.axes[subplot_index].annotate("%3.2f%%\n calm" % pct_calm, xy=(0, -2.5), ha='center', va='center') + # Set the ticks to be nice numbers tick_max = tick_interval * round( np.nanmax(np.cumsum(wind_hist, axis=1)) / tick_interval) diff --git a/act/tests/baseline/test_wind_rose.png b/act/tests/baseline/test_wind_rose.png index 5ed2039859..95e6b4c1ee 100644 Binary files a/act/tests/baseline/test_wind_rose.png and b/act/tests/baseline/test_wind_rose.png differ diff --git a/act/tests/test_discovery.py b/act/tests/test_discovery.py index 783829fe2b..7f93b55ed1 100644 --- a/act/tests/test_discovery.py +++ b/act/tests/test_discovery.py @@ -31,7 +31,7 @@ def test_get_ord(): assert "ORD" in my_asoses.keys() assert np.all( np.equal(my_asoses["ORD"]["sknt"].values[:10], - np.array([13., 11., 11., 11., 9., 10., 10., 11., 11., 11.]))) + np.array([13., 11., 14., 14., 13., 11., 14., 13., 13., 13.]))) def test_get_region():