Commit ef6df62b authored by Le Roux Erwan's avatar Le Roux Erwan
Browse files

[EUROCODE DATA] improve display for the eurocode return level graphs legend, and title

parent 892385b4
No related merge requests found
Showing with 16 additions and 12 deletions
+16 -12
from enum import Enum import re
from experiment.eurocode_data.eurocode_region import AbstractEurocodeRegion, E, C2, C1 from experiment.eurocode_data.eurocode_region import AbstractEurocodeRegion, E, C2, C1
from root_utils import get_display_name_from_object_type from root_utils import get_display_name_from_object_type
...@@ -13,8 +12,9 @@ class AbstractDepartementAlpesFrancaises(object): ...@@ -13,8 +12,9 @@ class AbstractDepartementAlpesFrancaises(object):
pass pass
def __str__(self): def __str__(self):
return get_display_name_from_object_type(type(self)) + '( {} Eurocode region)'.format( departement_name = re.findall('[A-Z][^A-Z]*', get_display_name_from_object_type(type(self)))
get_display_name_from_object_type(type(self.eurocode_region))) departement_name = ' '.join(departement_name)
return departement_name + ' ({} Region)'.format(get_display_name_from_object_type(type(self.eurocode_region)))
class HauteSavoie(AbstractDepartementAlpesFrancaises): class HauteSavoie(AbstractDepartementAlpesFrancaises):
......
from experiment.eurocode_data.utils import LAST_YEAR_FOR_EUROCODE
class AbstractEurocodeRegion(object): class AbstractEurocodeRegion(object):
def __init__(self, sk0, sad) -> None: def __init__(self, sk0, sad) -> None:
...@@ -42,7 +45,7 @@ class AbstractEurocodeRegion(object): ...@@ -42,7 +45,7 @@ class AbstractEurocodeRegion(object):
def plot_max_loading(self, ax, altitudes): def plot_max_loading(self, ax, altitudes):
ax.plot(altitudes, [self.eurocode_max_loading(altitude) for altitude in altitudes], ax.plot(altitudes, [self.eurocode_max_loading(altitude) for altitude in altitudes],
label='Eurocode limit', color='k') label='Eurocode computed in {}'.format(LAST_YEAR_FOR_EUROCODE), color='k')
class C1(AbstractEurocodeRegion): class C1(AbstractEurocodeRegion):
......
...@@ -28,9 +28,9 @@ def plot_model_name_to_dep_to_ordered_return_level_uncertainties( ...@@ -28,9 +28,9 @@ def plot_model_name_to_dep_to_ordered_return_level_uncertainties(
ax6.remove() ax6.remove()
ax9.remove() ax9.remove()
plt.suptitle('50-year return levels for all French Alps departements. \n' plt.suptitle('50-year return levels of snow load for all French Alps departements. \n'
'Comparison between the maximum EUROCODE in the departement\n' 'Comparison between the maximum EUROCODE in the departement\n'
'and the maximum return level found for the massif belonging to the departement') 'and the maximum return level found (in 2017 for the non-stationary model) for the massif in the departement')
if show: if show:
plt.show() plt.show()
...@@ -53,7 +53,8 @@ def plot_dep_to_model_name_dep_to_ordered_return_level_uncertainties(ax, dep_cla ...@@ -53,7 +53,8 @@ def plot_dep_to_model_name_dep_to_ordered_return_level_uncertainties(ax, dep_cla
lower_bound = [r.poster_uncertainty_interval[0] for r in ordered_return_level_uncertaines] lower_bound = [r.poster_uncertainty_interval[0] for r in ordered_return_level_uncertaines]
upper_bound = [r.poster_uncertainty_interval[1] for r in ordered_return_level_uncertaines] upper_bound = [r.poster_uncertainty_interval[1] for r in ordered_return_level_uncertaines]
ax.fill_between(altitudes, lower_bound, upper_bound, color=color, alpha=alpha) ax.fill_between(altitudes, lower_bound, upper_bound, color=color, alpha=alpha)
ax.legend() ax.legend(loc=2)
ax.set_ylim([0.0, 4.0])
ax.set_title(str(dep_object)) ax.set_title(str(dep_object))
ax.set_ylabel('Maximum {} quantile in 2017 (in N $m^-2$)'.format(EUROCODE_QUANTILE)) ax.set_ylabel('50-year return level (N $m^-2$)')
ax.set_xlabel('Altitude') ax.set_xlabel('Altitude (m)')
...@@ -18,7 +18,7 @@ from root_utils import get_display_name_from_object_type ...@@ -18,7 +18,7 @@ from root_utils import get_display_name_from_object_type
def dep_to_ordered_return_level_uncertainties(model_class, last_year_for_the_data, altitudes): def dep_to_ordered_return_level_uncertainties(model_class, last_year_for_the_data, altitudes):
model_class_str = get_display_name_from_object_type(model_class).split('TemporalModel')[0] model_class_str = get_display_name_from_object_type(model_class).split('Stationary')[0] + 'Stationary'
model_name = model_class_str + ' 1958-' + str(last_year_for_the_data) model_name = model_class_str + ' 1958-' + str(last_year_for_the_data)
# Load altitude visualizer # Load altitude visualizer
altitude_visualizer = load_altitude_visualizer(AltitudeHypercubeVisualizer, altitudes=altitudes, altitude_visualizer = load_altitude_visualizer(AltitudeHypercubeVisualizer, altitudes=altitudes,
...@@ -42,7 +42,7 @@ def dep_to_ordered_return_level_uncertainties(model_class, last_year_for_the_dat ...@@ -42,7 +42,7 @@ def dep_to_ordered_return_level_uncertainties(model_class, last_year_for_the_dat
def main_drawing(): def main_drawing():
# Select parameters # Select parameters
fast_plot = [True, False][1] fast_plot = [True, False][0]
model_class_and_last_year = [ model_class_and_last_year = [
(StationaryTemporalModel, LAST_YEAR_FOR_EUROCODE), (StationaryTemporalModel, LAST_YEAR_FOR_EUROCODE),
(StationaryTemporalModel, 2017), (StationaryTemporalModel, 2017),
......
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