diff --git a/experiment/meteo_france_data/scm_models_data/abstract_study.py b/experiment/meteo_france_data/scm_models_data/abstract_study.py index ac9208b6353556857c942a131cd2c860f3f84300..792dd81639118e9f3524a1c0c32e4cc9e551a8e1 100644 --- a/experiment/meteo_france_data/scm_models_data/abstract_study.py +++ b/experiment/meteo_france_data/scm_models_data/abstract_study.py @@ -304,6 +304,7 @@ class AbstractStudy(object): axis_off=False, massif_name_to_hatch_boolean_list=None, norm=None, + massif_name_to_marker_style=None, ): if ax is None: ax = plt.gca() @@ -323,6 +324,7 @@ class AbstractStudy(object): massif_name_to_fill_kwargs = {massif_name: {'color': color} for massif_name, color in massif_name_to_color.items()} massif_names = list(massif_name_to_fill_kwargs.keys()) + masssif_coordinate_for_display = cls.massifs_coordinates_for_display(massif_names) for coordinate_id, coords_list in cls.idx_to_coords_list.items(): # Retrieve the list of coords (x,y) that define the contour of the massif of id coordinate_id @@ -337,6 +339,13 @@ class AbstractStudy(object): # Potentially, fill the inside of the polygon with some color if fill and coordinate_id in cls.coordinate_id_to_massif_name: massif_name = cls.coordinate_id_to_massif_name[coordinate_id] + if massif_name in massif_name_to_marker_style: + massif_coordinate = masssif_coordinate_for_display.df_all_coordinates.loc[massif_name, :].values + if massif_name in ['Maurienne', 'Mercantour']: + massif_coordinate[1] -= 5000 + ax.plot(massif_coordinate[0], + massif_coordinate[1], **massif_name_to_marker_style[massif_name]) + if massif_name_to_fill_kwargs is not None and massif_name in massif_name_to_fill_kwargs: fill_kwargs = massif_name_to_fill_kwargs[massif_name] ax.fill(*coords_list, **fill_kwargs) @@ -354,11 +363,7 @@ class AbstractStudy(object): # if is_hatch: # ax.add_patch(Polygon(xy=a, fill=False, hatch=hatch)) - # Display the center of the massif - masssif_coordinate_for_display = cls.massifs_coordinates_for_display(massif_names) - ax.scatter(masssif_coordinate_for_display.x_coordinates, - masssif_coordinate_for_display.y_coordinates, s=1) if show_label: # Improve some explanation on the X axis and on the Y axis ax.set_xlabel('Longitude (km)') diff --git a/experiment/paper_past_snow_loads/method/study_visualizer_for_non_stationary_trends.py b/experiment/paper_past_snow_loads/method/study_visualizer_for_non_stationary_trends.py index be8f34ada528d9fc8253e383da1152cc9cdd4c02..5905023795e3e18fc885239698eede30af43b5d3 100644 --- a/experiment/paper_past_snow_loads/method/study_visualizer_for_non_stationary_trends.py +++ b/experiment/paper_past_snow_loads/method/study_visualizer_for_non_stationary_trends.py @@ -25,6 +25,7 @@ class StudyVisualizerForNonStationaryTrends(StudyVisualizer): transformation_class, verbose, multiprocessing, complete_non_stationary_trend_analysis, normalization_under_one_observations, score_class) self.non_stationary_trend_test = [GevLocationTrendTest, GevScaleTrendTest, GevLocationAndScaleTrendTest] + self.non_stationary_trend_test_to_marker = dict(zip(self.non_stationary_trend_test, ["s", "^", "D"])) # Utils @@ -64,27 +65,33 @@ class StudyVisualizerForNonStationaryTrends(StudyVisualizer): def plot_trends(self): v = max(abs(min(self.massif_name_to_tdrl_value.values())), max(self.massif_name_to_tdrl_value.values())) - vmin, vmax = -v, v + vmin, vmax = -v, v self.study.visualize_study(massif_name_to_value=self.massif_name_to_tdrl_value, vmin=vmin, vmax=vmax, replace_blue_by_white=False, axis_off=True, show_label=False, - add_colorbar=True) + add_colorbar=True, + massif_name_to_marker_style=self.massif_name_to_marker_style) @cached_property def massif_name_to_tdrl_value(self): - return {m: t.time_derivative_of_return_level for m, t in self.massif_name_to_minimized_aic_non_stationary_trend_test.items()} + return {m: t.time_derivative_of_return_level for m, t in + self.massif_name_to_minimized_aic_non_stationary_trend_test.items()} @property - def massif_name_to_minimized_aic_model_class(self): - return {m: t.unconstrained_model_class for m, t in self.massif_name_to_minimized_aic_non_stationary_trend_test.items()} - - @property - def massif_name_to_model_significance_symbol(self): - return {} - + def massif_name_to_marker_style(self): + d = {} + for m, t in self.massif_name_to_minimized_aic_non_stationary_trend_test.items(): + d[m] = {'marker': self.non_stationary_trend_test_to_marker[type(t)], + 'color': 'k', + 'markersize': 5, + 'fillstyle': 'full' if t.is_significant else 'none'} + return d # Part 1 - Uncertainty return level plot - + @property + def massif_name_to_minimized_aic_model_class(self): + return {m: t.unconstrained_model_class for m, t in + self.massif_name_to_minimized_aic_non_stationary_trend_test.items()} def massif_name_to_uncertainty(self): pass