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 c95dffec8169153b4d103a327f3005e137cc5c02..35acef695e0a9ed8f9b8c6375aaddd1c8f702f01 100644 --- a/experiment/meteo_france_data/scm_models_data/crocus/crocus.py +++ b/experiment/meteo_france_data/scm_models_data/crocus/crocus.py @@ -5,8 +5,9 @@ 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, CrocusDensityVariable + CrocusDepthVariable, CrocusRecentSweVariableThreeDays, TotalSnowLoadVariable, RecentSnowLoadVariableThreeDays, \ + CrocusSnowLoadEurocodeVariable, CrocusDensityVariable, RecentSnowLoadVariableFiveDays, \ + RecentSnowLoadVariableSevenDays class Crocus(AbstractStudy): @@ -15,9 +16,12 @@ class Crocus(AbstractStudy): """ def __init__(self, variable_class, *args, **kwargs): - assert variable_class in [CrocusTotalSweVariable, CrocusDepthVariable, CrocusRecentSweVariable, - RecentSnowLoadVariable, TotalSnowLoadVariable, CrocusSnowLoadEurocodeVariable, - CrocusDensityVariable] + assert variable_class in [CrocusTotalSweVariable, CrocusDepthVariable, CrocusRecentSweVariableThreeDays, + RecentSnowLoadVariableThreeDays, TotalSnowLoadVariable, + CrocusSnowLoadEurocodeVariable, + CrocusDensityVariable, + RecentSnowLoadVariableFiveDays, + RecentSnowLoadVariableSevenDays] super().__init__(variable_class, *args, **kwargs) self.model_name = 'Crocus' @@ -34,7 +38,7 @@ class Crocus(AbstractStudy): class CrocusSwe3Days(Crocus): def __init__(self, *args, **kwargs): - Crocus.__init__(self, CrocusRecentSweVariable, *args, **kwargs) + Crocus.__init__(self, CrocusRecentSweVariableThreeDays, *args, **kwargs) def apply_annual_aggregation(self, time_serie): return self.winter_annual_aggregation(time_serie) @@ -59,7 +63,17 @@ class CrocusSnowLoadTotal(Crocus): class CrocusSnowLoad3Days(CrocusSweTotal): def __init__(self, *args, **kwargs): - Crocus.__init__(self, RecentSnowLoadVariable, *args, **kwargs) + Crocus.__init__(self, RecentSnowLoadVariableThreeDays, *args, **kwargs) + + +class CrocusSnowLoad5Days(CrocusSweTotal): + def __init__(self, *args, **kwargs): + Crocus.__init__(self, RecentSnowLoadVariableFiveDays, *args, **kwargs) + + +class CrocusSnowLoad7Days(CrocusSweTotal): + def __init__(self, *args, **kwargs): + Crocus.__init__(self, RecentSnowLoadVariableSevenDays, *args, **kwargs) class ExtendedCrocusSweTotal(AbstractExtendedStudy, CrocusSweTotal): 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 f4c410ff89644143cc5f584ff6ce4cf1d380f0f1..02c9d3b1aa4e76f57b03878bef42ac4306c9e134 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 @@ -20,7 +20,7 @@ class CrocusTotalSweVariable(CrocusVariable): return 'WSN_T_ISBA' -class CrocusRecentSweVariable(CrocusTotalSweVariable): +class CrocusRecentSweVariableThreeDays(CrocusTotalSweVariable): NAME = 'Snow Water Equivalent last 3 days' @classmethod @@ -28,6 +28,22 @@ class CrocusRecentSweVariable(CrocusTotalSweVariable): return 'SWE_3DY_ISBA' +class CrocusRecentSweVariableFiveDays(CrocusTotalSweVariable): + NAME = 'Snow Water Equivalent last 5 days' + + @classmethod + def keyword(cls): + return 'SWE_5DY_ISBA' + + +class CrocusRecentSweVariableSevenDays(CrocusTotalSweVariable): + NAME = 'Snow Water Equivalent last 7 days' + + @classmethod + def keyword(cls): + return 'SWE_7DY_ISBA' + + class AbstractSnowLoadVariable(CrocusVariable): UNIT = 'kN $m^{-2}$' @@ -37,10 +53,18 @@ class AbstractSnowLoadVariable(CrocusVariable): return snow_pressure -class RecentSnowLoadVariable(AbstractSnowLoadVariable, CrocusRecentSweVariable): +class RecentSnowLoadVariableThreeDays(AbstractSnowLoadVariable, CrocusRecentSweVariableThreeDays): NAME = 'Snow load last 3 days' +class RecentSnowLoadVariableFiveDays(AbstractSnowLoadVariable, CrocusRecentSweVariableFiveDays): + NAME = 'Snow load last 5 days' + + +class RecentSnowLoadVariableSevenDays(AbstractSnowLoadVariable, CrocusRecentSweVariableSevenDays): + NAME = 'Snow load last 7 days' + + class TotalSnowLoadVariable(AbstractSnowLoadVariable, CrocusTotalSweVariable): NAME = 'Snow load total' 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 cacd15f398166f173ac705c7f29bfa464af84670..102dedd5efc90357f1f46081f0878a5c2105c341 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 @@ -11,7 +11,7 @@ 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, \ ExtendedCrocusSweTotal, CrocusDaysWithSnowOnGround, CrocusSwe3Days, CrocusSnowLoad3Days, CrocusSnowLoadTotal, \ - CrocusSnowLoadEurocode + CrocusSnowLoadEurocode, CrocusSnowLoad5Days, CrocusSnowLoad7Days from experiment.meteo_france_data.scm_models_data.safran.safran import SafranSnowfall, ExtendedSafranSnowfall, \ SafranRainfall, \ SafranTemperature, SafranTotalPrecip @@ -39,6 +39,8 @@ SCM_STUDY_CLASS_TO_ABBREVIATION = { CrocusDepth: 'SD', CrocusSnowLoadTotal: 'GSL', CrocusSnowLoad3Days: 'GSL3', + CrocusSnowLoad5Days: 'GSL5', + CrocusSnowLoad7Days: 'GSL7', CrocusSnowDensityAtMaxofSwe: '{} when the max of GSL \nis reached'.format(snow_density_str), CrocusDifferenceSnowLoadRescaledAndEurocodeToSeeSynchronization: 'max GSL rescaled - GSL from max HS \nboth with {}'.format(eurocode_snow_density), CrocusDifferenceSnowLoad: ('max GSL - GSL from max HS \n with {}'.format(eurocode_snow_density)), diff --git a/experiment/paper_past_snow_loads/result_trends_and_return_levels/main_result_trends_and_return_levels.py b/experiment/paper_past_snow_loads/result_trends_and_return_levels/main_result_trends_and_return_levels.py index 77eb695bebadc7a65e186a05cbf6d946885e74ca..57022684050fafd87a002514aec4d721bad38f03 100644 --- a/experiment/paper_past_snow_loads/result_trends_and_return_levels/main_result_trends_and_return_levels.py +++ b/experiment/paper_past_snow_loads/result_trends_and_return_levels/main_result_trends_and_return_levels.py @@ -2,7 +2,8 @@ from multiprocessing.pool import Pool import matplotlib as mpl -from experiment.meteo_france_data.scm_models_data.crocus.crocus import CrocusSnowLoadTotal, CrocusSnowLoadEurocode +from experiment.meteo_france_data.scm_models_data.crocus.crocus import CrocusSnowLoadTotal, CrocusSnowLoadEurocode, \ + CrocusSnowLoad3Days, CrocusSnowLoad5Days, CrocusSnowLoad7Days from experiment.paper_past_snow_loads.paper_main_utils import load_altitude_to_visualizer from experiment.paper_past_snow_loads.paper_utils import paper_study_classes, paper_altitudes from experiment.paper_past_snow_loads.result_trends_and_return_levels.plot_uncertainty_curves import \ @@ -82,7 +83,9 @@ def major_result(): uncertainty_methods = [ConfidenceIntervalMethodFromExtremes.my_bayes, ConfidenceIntervalMethodFromExtremes.ci_mle][1:] massif_names = None - for study_class in paper_study_classes[:2]: + study_classes = paper_study_classes[:2] + study_classes = [CrocusSnowLoad3Days, CrocusSnowLoad5Days, CrocusSnowLoad7Days][::-1] + for study_class in study_classes: if study_class == CrocusSnowLoadEurocode: non_stationary_uncertainty = [False] else: @@ -91,12 +94,12 @@ def major_result(): if __name__ == '__main__': - # major_result() - intermediate_result(altitudes=[900, 1200], massif_names=['Vercors'], - uncertainty_methods=[ConfidenceIntervalMethodFromExtremes.my_bayes, - ConfidenceIntervalMethodFromExtremes.ci_mle][1:], - non_stationary_uncertainty=[False, True][1:], - multiprocessing=True) + major_result() + # intermediate_result(altitudes=[900, 1200], massif_names=['Vercors'], + # uncertainty_methods=[ConfidenceIntervalMethodFromExtremes.my_bayes, + # ConfidenceIntervalMethodFromExtremes.ci_mle][1:], + # non_stationary_uncertainty=[False, True][1:], + # multiprocessing=True) # intermediate_result(altitudes=[900, 1200], massif_names=['Maurienne'], # uncertainty_methods=[ConfidenceIntervalMethodFromExtremes.my_bayes, # ConfidenceIntervalMethodFromExtremes.ci_mle][1:],