Commit 63d9d31f authored by Le Roux Erwan's avatar Le Roux Erwan
Browse files

[SCM] improve name display for crocus variables.

parent 0e828d6b
No related merge requests found
Showing with 17 additions and 9 deletions
+17 -9
...@@ -15,13 +15,16 @@ class Crocus(AbstractStudy): ...@@ -15,13 +15,16 @@ class Crocus(AbstractStudy):
super().__init__(variable_class, altitude) super().__init__(variable_class, altitude)
self.model_name = 'Crocus' self.model_name = 'Crocus'
@property
def variable_name(self):
suffix = '' if self.altitude == 2400 else ' average of data observed every 6 hours'
return super().variable_name + suffix
class CrocusSwe(Crocus): class CrocusSwe(Crocus):
def __init__(self, altitude=1800): def __init__(self, altitude=1800):
super().__init__(CrocusSweVariable, altitude) super().__init__(CrocusSweVariable, altitude)
class ExtendedCrocusSwe(AbstractExtendedStudy, CrocusSwe): class ExtendedCrocusSwe(AbstractExtendedStudy, CrocusSwe):
pass pass
......
...@@ -33,11 +33,11 @@ def study_iterator(study_class, only_first_one=False, both_altitude=False, verbo ...@@ -33,11 +33,11 @@ def study_iterator(study_class, only_first_one=False, both_altitude=False, verbo
def extended_visualization(): def extended_visualization():
save_to_file = False save_to_file = True
only_first_one = True only_first_one = False
for study_class in SCM_EXTENDED_STUDIES[:1]: for study_class in SCM_EXTENDED_STUDIES[:]:
for study in study_iterator(study_class, only_first_one=only_first_one): for study in study_iterator(study_class, only_first_one=only_first_one):
study_visualizer = StudyVisualizer(study, save_to_file=save_to_file, only_first_row=True) study_visualizer = StudyVisualizer(study, save_to_file=save_to_file, only_one_graph=True)
# study_visualizer.visualize_all_mean_and_max_graphs() # study_visualizer.visualize_all_mean_and_max_graphs()
study_visualizer.visualize_all_experimental_law() study_visualizer.visualize_all_experimental_law()
# for study_class in SCM_EXTENDED_STUDIES[:]: # for study_class in SCM_EXTENDED_STUDIES[:]:
......
...@@ -146,11 +146,16 @@ class StudyVisualizer(object): ...@@ -146,11 +146,16 @@ class StudyVisualizer(object):
label_function = ax.set_ylabel if self.vertical_kde_plot else ax.set_xlabel label_function = ax.set_ylabel if self.vertical_kde_plot else ax.set_xlabel
label_function(xlabel) label_function(xlabel)
sorted_x_levels = sorted(list([x_level for x_level, _ in name_to_xlevel_and_color.values()])) sorted_x_levels = sorted(list([x_level for x_level, _ in name_to_xlevel_and_color.values()]))
extraticks = [float(float_to_str_with_only_some_significant_digits(x, nb_digits=2))
for x in sorted_x_levels] # Take all the ticks
if not self.only_one_graph: # extraticks = [float(float_to_str_with_only_some_significant_digits(x, nb_digits=2))
extraticks = [name_to_xlevel_and_color['mean'][0], name_to_xlevel_and_color[AbstractParams.QUANTILE_100][0]] # for x in sorted_x_levels]
# Display only some specific ticks
extraticks = [name_to_xlevel_and_color['mean'][0], name_to_xlevel_and_color[AbstractParams.QUANTILE_100][0]]
set_ticks_function = ax.set_yticks if self.vertical_kde_plot else ax.set_xticks set_ticks_function = ax.set_yticks if self.vertical_kde_plot else ax.set_xticks
# Round up the ticks with a given number of significative digits
extraticks = [float(float_to_str_with_only_some_significant_digits(t, nb_digits=2)) for t in extraticks]
set_ticks_function(extraticks) set_ticks_function(extraticks)
if not self.only_one_graph: if not self.only_one_graph:
ax.set_title(self.study.safran_massif_names[massif_id]) ax.set_title(self.study.safran_massif_names[massif_id])
......
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