diff --git a/projects/exceeding_snow_loads/presentation/accumulation_in_winter.py b/projects/exceeding_snow_loads/presentation/accumulation_in_winter.py index d73bc1af7aba6c417adc45eb85110f3adb1305f3..7088d277f436f4219477e629e8fdcb89694f73cd 100644 --- a/projects/exceeding_snow_loads/presentation/accumulation_in_winter.py +++ b/projects/exceeding_snow_loads/presentation/accumulation_in_winter.py @@ -1,11 +1,13 @@ import matplotlib.pyplot as plt from extreme_data.meteo_france_data.scm_models_data.crocus.crocus import CrocusSnowLoadTotal, CrocusDepth from extreme_data.meteo_france_data.scm_models_data.crocus.crocus_variables import AbstractSnowLoadVariable +from extreme_data.meteo_france_data.scm_models_data.safran.safran import SafranSnowfall1Day ax = plt.gca() fontsize = 20 altitude = 1800 -studies = [CrocusSnowLoadTotal(altitude=altitude), CrocusDepth(altitude=altitude)] +# studies = [CrocusSnowLoadTotal(altitude=altitude), CrocusDepth(altitude=altitude)] +studies = [SafranSnowfall1Day(altitude=altitude), CrocusDepth(altitude=altitude)] colors = ['black', 'grey'] for i, study in enumerate(studies): color = colors[i] @@ -18,7 +20,10 @@ for i, study in enumerate(studies): days = [d[5:] for d in study.year_to_days[year]] x = list(range(len(days))) if i == 0: - ylabel = 'ground snow load ({})'.format(AbstractSnowLoadVariable.UNIT) + if isinstance(study, SafranSnowfall1Day): + ylabel = 'snowfall (mm)' + else: + ylabel = 'ground snow load ({})'.format(AbstractSnowLoadVariable.UNIT) else: ylabel = 'snow depth (m)' ax.set_ylabel(ylabel, fontsize=fontsize) diff --git a/projects/exceeding_snow_loads/presentation/main_example_snow_depth_total_plot.py b/projects/exceeding_snow_loads/presentation/main_example_snow_depth_total_plot.py index ebc0d5a88064711557bc00659eba5cc7b67eb3f2..35391836f9080b97c54c216bc34483e464a91c22 100644 --- a/projects/exceeding_snow_loads/presentation/main_example_snow_depth_total_plot.py +++ b/projects/exceeding_snow_loads/presentation/main_example_snow_depth_total_plot.py @@ -13,7 +13,7 @@ def tuples_for_examples_paper1(examples_for_the_paper=True): marker_altitude_massif_name_for_paper1 = [ # ('magenta', 900, 'Ubaye'), - ('darkblue', 1800, 'Vercors'), + ('darkblue', 900, 'Chartreuse'), # ('mediumpurple', 2700, 'Beaufortain'), ] else: diff --git a/projects/exceeding_snow_loads/presentation/statistical_model.py b/projects/exceeding_snow_loads/presentation/statistical_model.py index a5aa15767a99fa507015e8cc0cf35d2a4bc4c445..8fe44fea35197faa76226b388e17a71c3d9e8e69 100644 --- a/projects/exceeding_snow_loads/presentation/statistical_model.py +++ b/projects/exceeding_snow_loads/presentation/statistical_model.py @@ -33,28 +33,30 @@ def histogram_for_gev(): from extreme_data.meteo_france_data.scm_models_data.crocus.crocus import CrocusDepth ax = plt.gca() study_class = CrocusDepth - study = study_class(altitude=1800) - s = study.observations_annual_maxima.df_maxima_gev.loc['Vercors'] + study = study_class(altitude=900) + s = study.observations_annual_maxima.df_maxima_gev.loc['Chartreuse'] x_gev = s.values gev_params = fitted_stationary_gev(x_gev) print(gev_params.return_level(return_period=50)) samples = gev_params.sample(10000) - nb = 10 + nb = 12 epsilon = 0.0 - x, bins, p = ax.hist(samples, bins=nb, color='white', edgecolor='grey', density=True, stacked=True, - linewidth=3, bottom=[-epsilon for _ in range(nb)]) + x, bins, p = ax.hist(samples, bins=[0.25 * i for i in range(10)], + color='white', edgecolor='grey', density=True, stacked=True, + linewidth=3) for item in p: item.set_height((item.get_height() / sum(x))) - # print(gev_params) + print(gev_params) # x = np.linspace(0.0, 10, 1000) # y = gev_params.density(x) # ax.plot(x, y, linewidth=5) ax.set_xlabel('Annual maximum of snow depth (m)', fontsize=15) ax.set_ylabel('Probability', fontsize=15) ax.tick_params(axis='both', which='major', labelsize=15) - ax.set_yticks([0, 0.1, 0.2, 0.3]) - ax.set_xlim([0, 2.5]) - ax.set_ylim([0, 0.3]) + ax.set_yticks([0.1 * j for j in range(4)]) + ax.set_xticks([0.5 * j for j in range(5)]) + ax.set_xlim([0, 2]) + ax.set_ylim([0, 0.36]) def histogram_for_normal():