Commit 952ce5c9 authored by Le Roux Erwan's avatar Le Roux Erwan
Browse files

add eurocode snow load

parent d5e44fb6
No related merge requests found
Showing with 70 additions and 21 deletions
+70 -21
......@@ -3,7 +3,8 @@ 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
CrocusDepthVariable, CrocusRecentSweVariable, TotalSnowLoadVariable, RecentSnowLoadVariable, \
CrocusSnowLoadEurocodeVariable
class Crocus(AbstractStudy):
......@@ -13,7 +14,7 @@ class Crocus(AbstractStudy):
def __init__(self, variable_class, *args, **kwargs):
assert variable_class in [CrocusTotalSweVariable, CrocusDepthVariable, CrocusRecentSweVariable,
RecentSnowLoadVariable, TotalSnowLoadVariable]
RecentSnowLoadVariable, TotalSnowLoadVariable, CrocusSnowLoadEurocodeVariable]
super().__init__(variable_class, *args, **kwargs)
self.model_name = 'Crocus'
......@@ -71,6 +72,13 @@ class CrocusDepth(Crocus):
return self.winter_annual_aggregation(time_serie)
class CrocusSnowLoadEurocode(Crocus):
def __init__(self, *args, **kwargs):
Crocus.__init__(self, CrocusSnowLoadEurocodeVariable, *args, **kwargs)
class ExtendedCrocusDepth(AbstractExtendedStudy, CrocusDepth):
pass
......
......@@ -4,6 +4,7 @@ from experiment.meteo_france_data.scm_models_data.abstract_variable import Abstr
class CrocusVariable(AbstractVariable):
snow_load_multiplication_factor = 9.81 / 1000
@property
def daily_time_serie_array(self) -> np.ndarray:
......@@ -29,11 +30,11 @@ class CrocusRecentSweVariable(CrocusTotalSweVariable):
class AbstractSnowLoadVariable(CrocusVariable):
UNIT = 'kN $m^{-2}$'
snow_load_multiplication_factor = 9.81 / 1000
@property
def daily_time_serie_array(self) -> np.ndarray:
return self.snow_load_multiplication_factor * super().daily_time_serie_array
snow_pressure = self.snow_load_multiplication_factor * super().daily_time_serie_array
return snow_pressure
class RecentSnowLoadVariable(AbstractSnowLoadVariable, CrocusRecentSweVariable):
......@@ -51,3 +52,13 @@ class CrocusDepthVariable(CrocusVariable):
@classmethod
def keyword(cls):
return "DSN_T_ISBA"
class CrocusSnowLoadEurocodeVariable(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_pressure = self.snow_load_multiplication_factor * snow_weight
return snow_pressure
......@@ -6,7 +6,8 @@ from experiment.meteo_france_data.scm_models_data.visualization.study_visualizat
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
ExtendedCrocusSweTotal, CrocusDaysWithSnowOnGround, CrocusSwe3Days, CrocusSnowLoad3Days, CrocusSnowLoadTotal, \
CrocusSnowLoadEurocode
from experiment.meteo_france_data.scm_models_data.safran.safran import SafranSnowfall, ExtendedSafranSnowfall, \
SafranRainfall, \
SafranTemperature, SafranTotalPrecip
......@@ -25,6 +26,7 @@ SCM_STUDY_CLASS_TO_ABBREVIATION = {
SafranSnowfall: 'SF3',
CrocusSweTotal: 'SWE',
CrocusSwe3Days: 'SWE3',
CrocusSnowLoadEurocode: 'SL_Eurocode',
CrocusDepth: 'SD',
CrocusSnowLoadTotal: 'SL',
CrocusSnowLoad3Days: 'SL3',
......
......@@ -625,13 +625,13 @@ 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):
def visualize_max_graphs_poster(self, massif_name, altitude, snow_abbreviation, color, label=None, last_plot=True, ax=None, linestyle=None):
massif_names = self.study.study_massif_names
# Display the graph of the max on top
if ax is None:
ax = plt.gca()
x, y = self.smooth_maxima_x_y(massif_names.index(massif_name))
ax.plot(x, y, color=color, linewidth=5, label=label)
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)
if last_plot:
......
from experiment.meteo_france_data.scm_models_data.crocus.crocus import CrocusSnowLoad3Days, CrocusSnowLoadTotal
from experiment.meteo_france_data.scm_models_data.crocus.crocus import CrocusSnowLoad3Days, CrocusSnowLoadTotal, \
CrocusSnowLoadEurocode
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():
def max_graph_annual_maxima_poster_separate():
"""
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
# marker_altitude_massif_name_and_study_class = [
# ('magenta', 900, 'Parpaillon', CrocusSnowLoadTotal),
# ('darkmagenta', 1800, 'Vercors', CrocusSnowLoadTotal),
# ('mediumpurple', 2700, 'Vanoise', CrocusSnowLoadTotal),
# ]
marker_altitude_massif_name_and_study_class = [
('magenta', 900, 'Ubaye', CrocusSnowLoadTotal),
('darkmagenta', 1800, 'Vercors', CrocusSnowLoadTotal),
('mediumpurple', 2700, 'Beaufortain', CrocusSnowLoadTotal),
study_class = [CrocusSnowLoadTotal, CrocusSnowLoadEurocode][-1]
marker_altitude_massif_name = [
('magenta', 900, 'Ubaye'),
('darkmagenta', 1800, 'Vercors'),
('mediumpurple', 2700, 'Beaufortain'),
]
ax = plt.gca()
for color, altitude, massif_name, study_class in marker_altitude_massif_name_and_study_class:
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,
......@@ -34,5 +30,37 @@ def max_graph_annual_maxima_poster():
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)
if __name__ == '__main__':
max_graph_annual_maxima_poster()
# max_graph_annual_maxima_poster_separate()
max_graph_annual_maxima_poster_together()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment