diff --git a/experiment/eurocode_data/eurocode_region.py b/experiment/eurocode_data/eurocode_region.py index 7dfdeb5f1d7d052dca737e2657b75cae1ab7f93d..5fc8031949cda247cf4a9a013016f2f9700954e2 100644 --- a/experiment/eurocode_data/eurocode_region.py +++ b/experiment/eurocode_data/eurocode_region.py @@ -44,9 +44,9 @@ class AbstractEurocodeRegion(object): def lois_de_variation_1000_and_2000(self): return 3.5, -2.45 - def plot_max_loading(self, ax, altitudes, label='Eurocode standards'): - ax.plot(altitudes, [self.eurocode_max_loading(altitude) for altitude in altitudes], - label=label, color=self.eurocode_color, linewidth=5) + def plot_eurocode_snow_load_on_ground_characteristic_value_variable_action(self, ax, altitudes, label='Eurocode standards', linestyle=None): + ax.plot(altitudes, [self.valeur_caracteristique(altitude) for altitude in altitudes], + label=label, color=self.eurocode_color, linewidth=5, linestyle=linestyle) @classproperty def eurocode_color(self): diff --git a/experiment/eurocode_data/eurocode_visualizer.py b/experiment/eurocode_data/eurocode_visualizer.py index e4f0ff21d6f4bef52fc7a5caa04e38941f1f5244..dcf9bec186ea9dcdd7539bdb9f9d76943b9e7171 100644 --- a/experiment/eurocode_data/eurocode_visualizer.py +++ b/experiment/eurocode_data/eurocode_visualizer.py @@ -67,7 +67,7 @@ def plot_label_to_ordered_return_level_uncertainties(ax, massif_name, model_name ordered_return_level_uncertaines = l[1] # type: List[EurocodeConfidenceIntervalFromExtremes] # Plot eurocode standards only for the first loop if j == 0: - eurocode_region.plot_max_loading(ax, altitudes=altitudes) + eurocode_region.plot_eurocode_snow_load_on_ground_characteristic_value_variable_action(ax, altitudes=altitudes) conversion_factor = 9.8 / 1000 mean = [r.mean_estimate * conversion_factor for r in ordered_return_level_uncertaines] # Filter and keep only non nan values 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 07f7a2be4e440098387c91550b47cf7da238ff59..752d70930b231676867287283b08c7ceb820dcf3 100644 --- a/experiment/meteo_france_data/scm_models_data/abstract_study.py +++ b/experiment/meteo_france_data/scm_models_data/abstract_study.py @@ -114,6 +114,14 @@ class AbstractStudy(object): year_to_annual_maxima[year] = time_serie.max(axis=0) return year_to_annual_maxima + @cached_property + def year_to_annual_maxima_index(self) -> OrderedDict: + # Map each year to an array of size nb_massif + year_to_annual_maxima = OrderedDict() + for year, time_serie in self._year_to_max_daily_time_serie.items(): + year_to_annual_maxima[year] = time_serie.argmax(axis=0) + return year_to_annual_maxima + """ Annual total """ @property @@ -265,7 +273,7 @@ class AbstractStudy(object): @property def variable_name(self): - return self.variable_class.NAME + ' (in {})'.format(self.variable_unit) + return self.variable_class.NAME + ' ({})'.format(self.variable_unit) @property def variable_unit(self): diff --git a/experiment/meteo_france_data/scm_models_data/crocus/crocus.py b/experiment/meteo_france_data/scm_models_data/crocus/crocus.py index 94d7a2fd0212198be757c9b814bb23ce5eadc425..c95dffec8169153b4d103a327f3005e137cc5c02 100644 --- a/experiment/meteo_france_data/scm_models_data/crocus/crocus.py +++ b/experiment/meteo_france_data/scm_models_data/crocus/crocus.py @@ -1,10 +1,12 @@ +from collections import OrderedDict + import numpy as np from experiment.meteo_france_data.scm_models_data.abstract_extended_study import AbstractExtendedStudy from experiment.meteo_france_data.scm_models_data.abstract_study import AbstractStudy from experiment.meteo_france_data.scm_models_data.crocus.crocus_variables import CrocusTotalSweVariable, \ CrocusDepthVariable, CrocusRecentSweVariable, TotalSnowLoadVariable, RecentSnowLoadVariable, \ - CrocusSnowLoadEurocodeVariable + CrocusSnowLoadEurocodeVariable, CrocusDensityVariable class Crocus(AbstractStudy): @@ -14,7 +16,8 @@ class Crocus(AbstractStudy): def __init__(self, variable_class, *args, **kwargs): assert variable_class in [CrocusTotalSweVariable, CrocusDepthVariable, CrocusRecentSweVariable, - RecentSnowLoadVariable, TotalSnowLoadVariable, CrocusSnowLoadEurocodeVariable] + RecentSnowLoadVariable, TotalSnowLoadVariable, CrocusSnowLoadEurocodeVariable, + CrocusDensityVariable] super().__init__(variable_class, *args, **kwargs) self.model_name = 'Crocus' @@ -78,7 +81,6 @@ class CrocusSnowLoadEurocode(Crocus): Crocus.__init__(self, CrocusSnowLoadEurocodeVariable, *args, **kwargs) - class ExtendedCrocusDepth(AbstractExtendedStudy, CrocusDepth): pass @@ -102,8 +104,10 @@ if __name__ == '__main__': a = np.array(d[v]) print(list(a)) print(sorted(list(set(a)))) - print(study.year_to_daily_time_serie_array[1958]) + study = CrocusSnowLoadTotal(altitude=900) + print(study.year_to_annual_maxima_index) + print(study.year_to_daily_time_serie_array) - # a = study.year_to_daily_time_serie_array[1960] - # print(a) + # a = study.year_to_daily_time_serie_array[1960] + # print(a) diff --git a/experiment/meteo_france_data/scm_models_data/crocus/crocus_variables.py b/experiment/meteo_france_data/scm_models_data/crocus/crocus_variables.py index a69fe0cbe341f52da183b0f489a2540cbd95e227..f4c410ff89644143cc5f584ff6ce4cf1d380f0f1 100644 --- a/experiment/meteo_france_data/scm_models_data/crocus/crocus_variables.py +++ b/experiment/meteo_france_data/scm_models_data/crocus/crocus_variables.py @@ -54,11 +54,21 @@ class CrocusDepthVariable(CrocusVariable): return "DSN_T_ISBA" -class CrocusSnowLoadEurocodeVariable(CrocusDepthVariable): +class CrocusDensityVariable(CrocusVariable): + NAME = 'Snow Density' + UNIT = 'kg $m^-3$' + + @classmethod + def keyword(cls): + # Load the snow depth by default + return "DSN_T_ISBA" + + +class CrocusSnowLoadEurocodeVariable(AbstractSnowLoadVariable, CrocusDepthVariable): eurocode_snow_density = 150 @property def daily_time_serie_array(self) -> np.ndarray: - snow_weight = super().daily_time_serie_array * self.eurocode_snow_density + snow_weight = super(CrocusDepthVariable, self).daily_time_serie_array * self.eurocode_snow_density snow_pressure = self.snow_load_multiplication_factor * snow_weight return snow_pressure diff --git a/experiment/meteo_france_data/scm_models_data/visualization/study_visualization/main_study_visualizer.py b/experiment/meteo_france_data/scm_models_data/visualization/study_visualization/main_study_visualizer.py index a6db544b70d31e48ba3fdbf1ec1cc0522928824e..9832ac59370208f1d8a9e03cc0059fff03f46788 100644 --- a/experiment/meteo_france_data/scm_models_data/visualization/study_visualization/main_study_visualizer.py +++ b/experiment/meteo_france_data/scm_models_data/visualization/study_visualization/main_study_visualizer.py @@ -3,6 +3,8 @@ from typing import List from experiment.meteo_france_data.scm_models_data.visualization.study_visualization.study_visualizer import \ StudyVisualizer +from experiment.paper_past_snow_loads.data.crocus_study_comparison_with_eurocode import CrocusDifferenceSnowLoad, \ + CrocusSnowDensityAtMaxofSwe, CrocusDifferenceSnowLoadRescaledAndEurocodeToSeeSynchronization from experiment.trend_analysis.abstract_score import MannKendall from experiment.meteo_france_data.scm_models_data.abstract_study import AbstractStudy from experiment.meteo_france_data.scm_models_data.crocus.crocus import CrocusDepth, CrocusSweTotal, ExtendedCrocusDepth, \ @@ -19,6 +21,10 @@ from spatio_temporal_dataset.coordinates.transformed_coordinates.transformation. BetweenZeroAndOneNormalization, BetweenMinusOneAndOneNormalization from root_utils import get_display_name_from_object_type +snow_density_str = '$\\rho_{SNOW}$' +eurocode_snow_density = '{}=150 kg $m^-3$'.format(snow_density_str) +SLEurocode = 'SL from max HS with ' + eurocode_snow_density + SCM_STUDIES = [SafranSnowfall, CrocusSweTotal, CrocusDepth, CrocusSwe3Days] SCM_STUDIES_NAMES = [get_display_name_from_object_type(k) for k in SCM_STUDIES] SCM_STUDY_NAME_TO_SCM_STUDY = dict(zip(SCM_STUDIES_NAMES, SCM_STUDIES)) @@ -28,8 +34,11 @@ SCM_STUDY_CLASS_TO_ABBREVIATION = { CrocusSwe3Days: 'SWE3', CrocusSnowLoadEurocode: 'SL_Eurocode', CrocusDepth: 'SD', - CrocusSnowLoadTotal: 'SL', + CrocusSnowLoadTotal: 'max SL', CrocusSnowLoad3Days: 'SL3', + CrocusSnowDensityAtMaxofSwe: '{} when the max of SL \nis reached'.format(snow_density_str), + CrocusDifferenceSnowLoadRescaledAndEurocodeToSeeSynchronization: 'max SL rescaled - SL from max HS \nboth with {}'.format(eurocode_snow_density), + CrocusDifferenceSnowLoad: ('max SL - SL from max HS \n with {}'.format(eurocode_snow_density)) } altitude_massif_name_and_study_class_for_poster = [ @@ -44,13 +53,12 @@ altitude_massif_name_and_study_class_for_poster_evan = [ (2700, 'Parpaillon', CrocusSwe3Days), ] -altitude_massif_name_and_study_class_for_committee= [ +altitude_massif_name_and_study_class_for_committee = [ (900, 'Chartreuse', CrocusSnowLoad3Days), (1800, 'Vanoise', CrocusSnowLoad3Days), (2700, 'Parpaillon', CrocusSnowLoad3Days), ] - SCM_STUDY_NAME_TO_ABBREVIATION = {get_display_name_from_object_type(k): v for k, v in SCM_STUDY_CLASS_TO_ABBREVIATION.items()} SCM_COLORS = ['tab:orange', 'y', 'tab:purple', 'lightseagreen'] @@ -72,10 +80,12 @@ ALL_ALTITUDES_WITH_20_STATIONS_AT_LEAST = ALL_ALTITUDES[3:-6][:] ALL_STUDIES = SCM_STUDIES + [SafranTemperature, SafranRainfall] -def study_iterator_global(study_classes, only_first_one=False, verbose=True, altitudes=None, nb_days=None, orientations=None) -> \ +def study_iterator_global(study_classes, only_first_one=False, verbose=True, altitudes=None, nb_days=None, + orientations=None) -> \ List[AbstractStudy]: for study_class in study_classes: - for study in study_iterator(study_class, only_first_one, verbose, altitudes, nb_days, orientations=orientations): + for study in study_iterator(study_class, only_first_one, verbose, altitudes, nb_days, + orientations=orientations): yield study if only_first_one: break diff --git a/experiment/meteo_france_data/scm_models_data/visualization/study_visualization/study_visualizer.py b/experiment/meteo_france_data/scm_models_data/visualization/study_visualization/study_visualizer.py index 389bd027712e498eb4d2cf5a663dd53f6e4f5077..ba731820f8978ec86d117aff13e242e624989d59 100644 --- a/experiment/meteo_france_data/scm_models_data/visualization/study_visualization/study_visualizer.py +++ b/experiment/meteo_france_data/scm_models_data/visualization/study_visualization/study_visualizer.py @@ -625,7 +625,7 @@ class StudyVisualizer(VisualizationParameters): self.plot_name = plot_name self.show_or_save_to_file() - def visualize_max_graphs_poster(self, massif_name, altitude, snow_abbreviation, color, label=None, last_plot=True, ax=None, linestyle=None): + def visualize_max_graphs_poster(self, massif_name, altitude, snow_abbreviation, color, label=None, last_plot=True, ax=None, linestyle=None, tight_pad=None): massif_names = self.study.study_massif_names # Display the graph of the max on top if ax is None: @@ -634,18 +634,19 @@ class StudyVisualizer(VisualizationParameters): ax.plot(x, y, color=color, linewidth=5, label=label, linestyle=linestyle) # ax.set_ylabel('{} (in {})'.format(snow_abbreviation, self.study.variable_unit), color=color, fontsize=15) + + ax.xaxis.set_ticks(x[2::10]) + ax.tick_params(axis='both', which='major', labelsize=13) + plot_name = 'Annual maxima of {} in {} at {}m'.format(snow_abbreviation, massif_name, altitude) + self.plot_name = plot_name + ax.set_ylabel('{} (in {})'.format(snow_abbreviation, self.study.variable_unit), fontsize=15) + ax.set_xlabel('years', fontsize=15) + if label is None: + ax.set_title('{} at {} m'.format(massif_name, altitude)) if last_plot: - ax.xaxis.set_ticks(x[2::10]) - ax.tick_params(axis='both', which='major', labelsize=13) - plot_name = 'Annual maxima of {} in {} at {}m'.format(snow_abbreviation, massif_name, altitude) - self.plot_name = plot_name - ax.set_ylabel('{} (in {})'.format(snow_abbreviation, self.study.variable_unit), fontsize=15) - ax.set_xlabel('years', fontsize=15) - if label is not None: - ax.legend() - else: - ax.set_title('{} at {} m'.format(massif_name, altitude)) - self.show_or_save_to_file(add_classic_title=False, no_title=True) + ax.legend() + + self.show_or_save_to_file(add_classic_title=False, no_title=True, tight_layout=True, tight_pad=tight_pad) ax.clear() @staticmethod @@ -815,9 +816,12 @@ class StudyVisualizer(VisualizationParameters): ax.get_yaxis().set_visible(False) ax.set_aspect('equal') - def show_or_save_to_file(self, add_classic_title=True, no_title=False, tight_layout=False): + def show_or_save_to_file(self, add_classic_title=True, no_title=False, tight_layout=False, tight_pad=None): if tight_layout: - plt.tight_layout() + if tight_pad is not None: + plt.tight_layout(**tight_pad) + else: + plt.tight_layout() assert self.plot_name is not None if add_classic_title: title = self.study.title diff --git a/experiment/paper_past_snow_loads/data/crocus_study_comparison_with_eurocode.py b/experiment/paper_past_snow_loads/data/crocus_study_comparison_with_eurocode.py new file mode 100644 index 0000000000000000000000000000000000000000..5571c522382b78f8c293be7b8123cd06e5580ad1 --- /dev/null +++ b/experiment/paper_past_snow_loads/data/crocus_study_comparison_with_eurocode.py @@ -0,0 +1,61 @@ +from collections import OrderedDict + +import numpy as np + +from experiment.meteo_france_data.scm_models_data.crocus.crocus import Crocus, CrocusSweTotal, CrocusSnowLoadTotal, \ + CrocusSnowLoadEurocode +from experiment.meteo_france_data.scm_models_data.crocus.crocus_variables import TotalSnowLoadVariable, \ + CrocusDensityVariable + + +class CrocusSnowDensityAtMaxofSwe(Crocus): + + def __init__(self, *args, **kwargs): + super().__init__(CrocusDensityVariable, *args, **kwargs) + study_swe = CrocusSweTotal(*args, **kwargs) + self.year_to_snow_density_at_max_of_swe = OrderedDict() + for year in study_swe.ordered_years: + max_swe = study_swe.year_to_annual_maxima[year] + argmax_swe = study_swe.year_to_annual_maxima_index[year] + snow_depth = self.year_to_daily_time_serie_array[year] + snow_depth_at_max = np.take(np.transpose(snow_depth), argmax_swe) + self.year_to_snow_density_at_max_of_swe[year] = max_swe / snow_depth_at_max + + @property + def year_to_annual_maxima(self) -> OrderedDict: + return self.year_to_snow_density_at_max_of_swe + + +class CrocusDifferenceSnowLoadRescaledAndEurocodeToSeeSynchronization(Crocus): + + def __init__(self, *args, **kwargs): + super().__init__(TotalSnowLoadVariable, *args, **kwargs) + study_snow_load = CrocusSnowLoadTotal(*args, **kwargs) + study_snow_load_eurocode = CrocusSnowLoadEurocode(*args, **kwargs) + study_density = CrocusSnowDensityAtMaxofSwe(*args, **kwargs) + self.year_to_snow_difference = OrderedDict() + for year in study_density.ordered_years: + rescaling_factor = study_density.year_to_annual_maxima[year] / 150 + snow_load_rescaled = study_snow_load.year_to_annual_maxima[year] / rescaling_factor + self.year_to_snow_difference[year] = snow_load_rescaled - study_snow_load_eurocode.year_to_annual_maxima[ + year] + + @property + def year_to_annual_maxima(self) -> OrderedDict: + return self.year_to_snow_difference + + +class CrocusDifferenceSnowLoad(Crocus): + + def __init__(self, *args, **kwargs): + super().__init__(TotalSnowLoadVariable, *args, **kwargs) + study_snow_load = CrocusSnowLoadTotal(*args, **kwargs) + study_snow_load_eurocode = CrocusSnowLoadEurocode(*args, **kwargs) + self.year_to_snow_difference = OrderedDict() + for year in study_snow_load.ordered_years: + self.year_to_snow_difference[year] = study_snow_load.year_to_annual_maxima[year] \ + - study_snow_load_eurocode.year_to_annual_maxima[year] + + @property + def year_to_annual_maxima(self) -> OrderedDict: + return self.year_to_snow_difference \ No newline at end of file diff --git a/experiment/paper_past_snow_loads/data/main_comparison_with_eurocode.py b/experiment/paper_past_snow_loads/data/main_comparison_with_eurocode.py new file mode 100644 index 0000000000000000000000000000000000000000..7cfc18fc9c518081dcfac2d8068390cec7fc6180 --- /dev/null +++ b/experiment/paper_past_snow_loads/data/main_comparison_with_eurocode.py @@ -0,0 +1,53 @@ +from experiment.meteo_france_data.scm_models_data.visualization.study_visualization.main_study_visualizer import \ + study_iterator_global, SCM_STUDY_CLASS_TO_ABBREVIATION, snow_density_str +from experiment.meteo_france_data.scm_models_data.visualization.study_visualization.study_visualizer import \ + StudyVisualizer +import matplotlib.pyplot as plt + +from experiment.paper_past_snow_loads.data.crocus_study_comparison_with_eurocode import CrocusDifferenceSnowLoad, \ + CrocusSnowDensityAtMaxofSwe, CrocusDifferenceSnowLoadRescaledAndEurocodeToSeeSynchronization + + +def max_graph_annual_maxima_comparison(): + """ + We choose these massif because each represents a different eurocode region + we also choose them because they belong to a different climatic area + :return: + """ + save_to_file = True + study_classes = [CrocusSnowDensityAtMaxofSwe, CrocusDifferenceSnowLoadRescaledAndEurocodeToSeeSynchronization, CrocusDifferenceSnowLoad][:] + for study_class in study_classes: + + marker_altitude_massif_name = [ + ('magenta', 900, 'Ubaye'), + ('darkmagenta', 1800, 'Vercors'), + ('mediumpurple', 2700, 'Beaufortain'), + ] + ax = plt.gca() + for color, altitude, massif_name in marker_altitude_massif_name: + for study in study_iterator_global([study_class], altitudes=[altitude]): + study_visualizer = StudyVisualizer(study, save_to_file=save_to_file, + verbose=True, + multiprocessing=True) + snow_abbreviation = SCM_STUDY_CLASS_TO_ABBREVIATION[study_class] + label = '{} massif at {}m'.format(massif_name, altitude) + study_visualizer.visualize_max_graphs_poster(massif_name, altitude, snow_abbreviation, color, label, + False, ax) + last_plot = altitude == 2700 + if last_plot: + constant = 150 if study_class == CrocusSnowDensityAtMaxofSwe else 0 + label = '{} Eurocode'.format(snow_density_str) if study_class == CrocusSnowDensityAtMaxofSwe else None + snow_density_eurocode = [constant for _ in study.ordered_years] + ax.plot(study.ordered_years, snow_density_eurocode, color='k', label=label) + ax.legend() + tight_pad = {'h_pad': 0.2} + study_visualizer.show_or_save_to_file(no_title=True, tight_layout=True, tight_pad=tight_pad) + ax.clear() + + + + + + +if __name__ == '__main__': + max_graph_annual_maxima_comparison() \ No newline at end of file diff --git a/experiment/paper_past_snow_loads/data/main_eurocode_plot.py b/experiment/paper_past_snow_loads/data/main_eurocode_plot.py index 4cd94ebf2315b4c85b0259d4ebfbe55bc7068d7a..693a400bb118d5678e22dda103c6c43c556eb877 100644 --- a/experiment/paper_past_snow_loads/data/main_eurocode_plot.py +++ b/experiment/paper_past_snow_loads/data/main_eurocode_plot.py @@ -14,12 +14,13 @@ def main_eurocode_norms(ax=None): for region_class in [C1, C2, E][:]: region_object = region_class() label = get_display_name_from_object_type(region_class) + ' Eurocode region' - region_object.plot_max_loading(ax, altitudes, label=label) + linestyle = '--' if region_class == C2 else '-' + region_object.plot_eurocode_snow_load_on_ground_characteristic_value_variable_action(ax, altitudes, label=label, linestyle=linestyle) if region_class == E: ax.legend() ax.xaxis.set_ticks([250 * i for i in range(1, 9)]) ax.tick_params(axis='both', which='major', labelsize=13) - ax.set_ylabel('50-year return level (kN $m^-2$)') + ax.set_ylabel('50-year return level of SL (kN $m^-2$)') ax.set_xlabel('Altitude (m)') ax.set_ylim([0.0, 11.0]) ax.grid() @@ -34,5 +35,5 @@ def main_eurocode_map(ax=None): if __name__ == '__main__': - # main_eurocode_norms() - main_eurocode_map() + main_eurocode_norms() + # main_eurocode_map() diff --git a/experiment/paper_past_snow_loads/data/main_example_swe_total_plot.py b/experiment/paper_past_snow_loads/data/main_example_swe_total_plot.py index 2c0f8f77259908e134f42f9a2eca4fc261acb971..1038e7b05136b65c6f9107eee83127908906eead 100644 --- a/experiment/paper_past_snow_loads/data/main_example_swe_total_plot.py +++ b/experiment/paper_past_snow_loads/data/main_example_swe_total_plot.py @@ -1,19 +1,20 @@ -from experiment.meteo_france_data.scm_models_data.crocus.crocus import CrocusSnowLoad3Days, CrocusSnowLoadTotal, \ - CrocusSnowLoadEurocode +import matplotlib.pyplot as plt + +from experiment.meteo_france_data.scm_models_data.crocus.crocus import CrocusSnowLoadTotal from experiment.meteo_france_data.scm_models_data.visualization.study_visualization.main_study_visualizer import \ study_iterator_global, SCM_STUDY_CLASS_TO_ABBREVIATION from experiment.meteo_france_data.scm_models_data.visualization.study_visualization.study_visualizer import \ StudyVisualizer -import matplotlib.pyplot as plt -def max_graph_annual_maxima_poster_separate(): + +def max_graph_annual_maxima_poster(): """ We choose these massif because each represents a different eurocode region we also choose them because they belong to a different climatic area :return: """ - save_to_file = False - study_class = [CrocusSnowLoadTotal, CrocusSnowLoadEurocode][-1] + save_to_file = True + study_class = CrocusSnowLoadTotal marker_altitude_massif_name = [ ('magenta', 900, 'Ubaye'), ('darkmagenta', 1800, 'Vercors'), @@ -28,39 +29,10 @@ def max_graph_annual_maxima_poster_separate(): snow_abbreviation = SCM_STUDY_CLASS_TO_ABBREVIATION[study_class] last_plot = altitude == 2700 label = '{} massif at {}m'.format(massif_name, altitude) - study_visualizer.visualize_max_graphs_poster(massif_name, altitude, snow_abbreviation, color, label, last_plot, ax) - - -def max_graph_annual_maxima_poster_together(): - """ - We choose these massif because each represents a different eurocode region - we also choose them because they belong to a different climatic area - :return: - """ - save_to_file = False - study_class_and_marker = [ - (CrocusSnowLoadTotal, '-'), - (CrocusSnowLoadEurocode, (0, (1,1))), - ] - color_altitude_massif_name = [ - ('magenta', 900, 'Ubaye'), - ('darkmagenta', 1800, 'Vercors'), - ('mediumpurple', 2700, 'Beaufortain'), - ] - ax = plt.gca() - for color, altitude, massif_name in color_altitude_massif_name: - for study_class, linestyle in study_class_and_marker[::-1]: - for study in study_iterator_global([study_class], altitudes=[altitude]): - study_visualizer = StudyVisualizer(study, save_to_file=save_to_file, - verbose=True, - multiprocessing=True) - snow_abbreviation = SCM_STUDY_CLASS_TO_ABBREVIATION[study_class] - last_plot = altitude == 2700 and study_class == CrocusSnowLoadTotal - name = 'SL from Crocus SWE' if study_class == CrocusSnowLoadTotal else 'SL from Crocus HS and snow density=150 kg $m^-3$' - label = '{} for {} massif at {}m'.format(name, massif_name, altitude) - study_visualizer.visualize_max_graphs_poster(massif_name, altitude, snow_abbreviation, color, label, last_plot, ax, linestyle) + tight_pad = {'h_pad': 0.2} + study_visualizer.visualize_max_graphs_poster(massif_name, altitude, snow_abbreviation, color, label, + last_plot, ax, tight_pad=tight_pad) if __name__ == '__main__': - # max_graph_annual_maxima_poster_separate() - max_graph_annual_maxima_poster_together() + max_graph_annual_maxima_poster()