diff --git a/.coveragerc b/.coveragerc index 4edd7b1a2..f757a861d 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,2 +1,4 @@ [run] + relative_files = True +omit=*/test/histogram_2d/src/* diff --git a/metplotpy/plots/wind_rose/wind_rose.py b/metplotpy/plots/wind_rose/wind_rose.py index 35317feb7..fea5d5689 100644 --- a/metplotpy/plots/wind_rose/wind_rose.py +++ b/metplotpy/plots/wind_rose/wind_rose.py @@ -252,9 +252,19 @@ def _create_traces(self): number_of_records = len(wind_speed_dir) speed_bins = [] - # add me max wind speed as the last breaks + # If the last break is > max wind speed, omit the last break and + # use the Mean error (me) max wind speed as the last breaks value. breaks = self.config_obj.wind_rose_breaks.copy() - breaks.append(max(wind_speed)) + last_break_idx = len(breaks) - 1 + + if max(wind_speed) > breaks[last_break_idx]: + # append the max wind speed to the list of break values + breaks.append(max(wind_speed)) + else: + # replace the last break value with the max windspeed + breaks = breaks[:-1] + breaks.append(max(wind_speed)) + # loop selecting given bins and calculate frequencies for i in range(len(breaks) - 1): @@ -370,6 +380,7 @@ def write_output_file(self) -> None: filename = path[-1] else: filename = '.' + os.path.sep + os.makedirs(self.config_obj.points_path, exist_ok=True) filename = self.config_obj.points_path + os.path.sep + filename # save points