From 204325e0c9df968dc1570ba2565d2aa39cd38986 Mon Sep 17 00:00:00 2001 From: bikegeek Date: Mon, 4 Aug 2025 11:48:47 -0600 Subject: [PATCH 1/4] Add support for specifying the radial axis range --- metplotpy/plots/wind_rose/wind_rose.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/metplotpy/plots/wind_rose/wind_rose.py b/metplotpy/plots/wind_rose/wind_rose.py index 9ee6bec5f..a683934d6 100644 --- a/metplotpy/plots/wind_rose/wind_rose.py +++ b/metplotpy/plots/wind_rose/wind_rose.py @@ -162,7 +162,9 @@ def _create_figure(self): radialaxis_dtick=5, radialaxis_gridcolor=PLOTLY_AXIS_LINE_COLOR, radialaxis_showticklabels=True, - radialaxis_ticksuffix='%' + radialaxis_ticksuffix='%', + radialaxis_type="-", + radialaxis_range=self.config_obj.radialaxis_range, ) fig.update_layout( From 96ac5300f977376c998d6894297aab8b902b3618 Mon Sep 17 00:00:00 2001 From: bikegeek Date: Mon, 4 Aug 2025 13:04:45 -0600 Subject: [PATCH 2/4] Provide support for radial axis limits and use step size (for radial axis) in the config file (radialaxis_step) --- metplotpy/plots/wind_rose/wind_rose.py | 41 +++++++++++++------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/metplotpy/plots/wind_rose/wind_rose.py b/metplotpy/plots/wind_rose/wind_rose.py index a683934d6..350ed1e53 100644 --- a/metplotpy/plots/wind_rose/wind_rose.py +++ b/metplotpy/plots/wind_rose/wind_rose.py @@ -145,27 +145,26 @@ def _create_figure(self): automargin=True ) - fig.update_polars( - bgcolor=PLOTLY_PAPER_BGCOOR, - hole=0.08, - angularaxis_thetaunit="degrees", - angularaxis_rotation=90, - angularaxis_direction='clockwise', - angularaxis_gridcolor=PLOTLY_AXIS_LINE_COLOR, - angularaxis_tickvals=self.config_obj.angularaxis_tickvals, - angularaxis_ticktext=self.config_obj.angularaxis_ticktext, - angularaxis_tickmode='array', - radialaxis_angle=135, - radialaxis_tickmode='linear', - radialaxis_tickangle=100, - radialaxis_tick0=5, - radialaxis_dtick=5, - radialaxis_gridcolor=PLOTLY_AXIS_LINE_COLOR, - radialaxis_showticklabels=True, - radialaxis_ticksuffix='%', - radialaxis_type="-", - radialaxis_range=self.config_obj.radialaxis_range, - ) + if self.config_obj.radialaxis_range is None: + fig.update_polars( + bgcolor=PLOTLY_PAPER_BGCOOR, hole=0.08, angularaxis_thetaunit="degrees", angularaxis_rotation=90, + angularaxis_direction='clockwise', angularaxis_gridcolor=PLOTLY_AXIS_LINE_COLOR, + angularaxis_tickvals=self.config_obj.angularaxis_tickvals, + angularaxis_ticktext=self.config_obj.angularaxis_ticktext, angularaxis_tickmode='array', + radialaxis_angle=135, radialaxis_tickmode='linear', radialaxis_tickangle=100, radialaxis_tick0=5, + radialaxis_dtick=self.config_obj.radialaxis_step, radialaxis_gridcolor=PLOTLY_AXIS_LINE_COLOR, + radialaxis_showticklabels=True, + radialaxis_ticksuffix='%', radialaxis_type="-", ) + else: + fig.update_polars( + bgcolor=PLOTLY_PAPER_BGCOOR, hole=0.08, angularaxis_thetaunit="degrees", angularaxis_rotation=90, + angularaxis_direction='clockwise', angularaxis_gridcolor=PLOTLY_AXIS_LINE_COLOR, + angularaxis_tickvals=self.config_obj.angularaxis_tickvals, + angularaxis_ticktext=self.config_obj.angularaxis_ticktext, angularaxis_tickmode='array', + radialaxis_angle=135, radialaxis_tickmode='linear', radialaxis_tickangle=100, radialaxis_tick0=5, + radialaxis_dtick=self.config_obj.radialaxis_step, radialaxis_gridcolor=PLOTLY_AXIS_LINE_COLOR, + radialaxis_showticklabels=True, + radialaxis_ticksuffix='%', radialaxis_type="-", radialaxis_range=self.config_obj.radialaxis_range, ) fig.update_layout( showlegend=self.config_obj.show_legend, From 3829799c8e08b02dd647c91eceaa2e723e87226f Mon Sep 17 00:00:00 2001 From: bikegeek Date: Mon, 4 Aug 2025 13:07:48 -0600 Subject: [PATCH 3/4] Support for setting the step size (mandatory) and the radialaxis_range (uncomment to specify) --- metplotpy/plots/wind_rose/wind_rose_config.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/metplotpy/plots/wind_rose/wind_rose_config.py b/metplotpy/plots/wind_rose/wind_rose_config.py index 5f5e2d006..ffca30afd 100644 --- a/metplotpy/plots/wind_rose/wind_rose_config.py +++ b/metplotpy/plots/wind_rose/wind_rose_config.py @@ -43,12 +43,22 @@ def __init__(self, parameters): self.show_legend = self.get_config_value('show_legend') self.angularaxis_tickvals = self.get_config_value('angularaxis_tickvals') self.angularaxis_ticktext = self.get_config_value('angularaxis_ticktext') + + # Range of radial axes (start, end). The radial axis type is the default ('-'), in + # which Plotly attempts to determine the axis type based on looking at the + # data. The wind_rose.py sets this to '-' in the event of any future changes. + self.radialaxis_range = self.get_config_value('radialaxis_range') + self.radialaxis_step = self.get_config_value('radialaxis_step') + self.stat_input = self.get_config_value('stat_input') self.plot_width = self.get_config_value('plot_width') self.plot_height = self.get_config_value('plot_height') self.dump_points = self.get_config_value('dump_points') + # Optional setting, indicates *where* to save the dump_points_1 file # used by METviewer self.points_path = self.get_config_value('points_path') self.show_in_browser = self.get_config_value('show_in_browser') + + From 0ee40937e8d150c9860a5631da3bbf7737f2da9b Mon Sep 17 00:00:00 2001 From: bikegeek Date: Sun, 10 Aug 2025 17:09:03 -0600 Subject: [PATCH 4/4] Explicitly set the dtick0 to the first value in the radialaxis_range to ensure the step between axes is consistent with what is set in radialaxis_step --- metplotpy/plots/wind_rose/wind_rose.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/metplotpy/plots/wind_rose/wind_rose.py b/metplotpy/plots/wind_rose/wind_rose.py index 350ed1e53..35317feb7 100644 --- a/metplotpy/plots/wind_rose/wind_rose.py +++ b/metplotpy/plots/wind_rose/wind_rose.py @@ -161,7 +161,8 @@ def _create_figure(self): angularaxis_direction='clockwise', angularaxis_gridcolor=PLOTLY_AXIS_LINE_COLOR, angularaxis_tickvals=self.config_obj.angularaxis_tickvals, angularaxis_ticktext=self.config_obj.angularaxis_ticktext, angularaxis_tickmode='array', - radialaxis_angle=135, radialaxis_tickmode='linear', radialaxis_tickangle=100, radialaxis_tick0=5, + radialaxis_angle=135, radialaxis_tickmode='linear', radialaxis_tickangle=100, + radialaxis_tick0=self.config_obj.radialaxis_range[0], radialaxis_dtick=self.config_obj.radialaxis_step, radialaxis_gridcolor=PLOTLY_AXIS_LINE_COLOR, radialaxis_showticklabels=True, radialaxis_ticksuffix='%', radialaxis_type="-", radialaxis_range=self.config_obj.radialaxis_range, )