From 27193d8d27b6fdc6cd3ded01b2f462a8e62234a5 Mon Sep 17 00:00:00 2001
From: Le Roux Erwan <erwan.le-roux@irstea.fr>
Date: Tue, 16 Feb 2021 16:32:24 +0100
Subject: [PATCH] [projections] fix main_data.py plot

---
 .../adamont_data/adamont_studies.py           | 22 +++++++++----------
 projects/projected_snowfall/data/main_data.py |  8 +++----
 2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/extreme_data/meteo_france_data/adamont_data/adamont_studies.py b/extreme_data/meteo_france_data/adamont_data/adamont_studies.py
index 34fb794e..db07c62d 100644
--- a/extreme_data/meteo_france_data/adamont_data/adamont_studies.py
+++ b/extreme_data/meteo_france_data/adamont_data/adamont_studies.py
@@ -68,8 +68,8 @@ class AdamontStudies(object):
                 label = gcm_rcm_couple_to_str(gcm_rcm_couple)
                 color = gcm_rcm_couple_to_color[gcm_rcm_couple]
                 ax.plot(x, y, linewidth=linewidth, label=label, color=color)
-        if scm_study is None:
-            pass
+        # if scm_study is None:
+        #     pass
             # I should recode that, taking into account that the length of annual maxima is not the same
             # for all the time series
             # x = study.ordered_years
@@ -80,16 +80,16 @@ class AdamontStudies(object):
             #     label = 'Mean maxima'
             #     color = 'black'
             #     ax.plot(x, y, linewidth=linewidth * 2, label=label, color=color)
-        else:
+        # else:
             # todo: otherwise display the mean in strong black
-            try:
-                x = scm_study.ordered_years
-                y = scm_study.massif_name_to_annual_maxima[massif_name]
-                label = 'Reanalysis'
-                color = 'black'
-                ax.plot(x, y, linewidth=linewidth * 2, label=label, color=color)
-            except KeyError:
-                pass
+            # try:
+            #     x = scm_study.ordered_years
+            #     y = scm_study.massif_name_to_annual_maxima[massif_name]
+            #     label = 'Reanalysis'
+            #     color = 'black'
+            #     ax.plot(x, y, linewidth=linewidth * 2, label=label, color=color)
+            # except KeyError:
+            #     pass
 
         ticks = [year for year in range(self.year_min_studies, self.year_max_studies+1) if year % 10 == 0]
         ax.xaxis.set_ticks(ticks)
diff --git a/projects/projected_snowfall/data/main_data.py b/projects/projected_snowfall/data/main_data.py
index ff0460d1..a2fd78cd 100644
--- a/projects/projected_snowfall/data/main_data.py
+++ b/projects/projected_snowfall/data/main_data.py
@@ -20,15 +20,15 @@ from extreme_data.meteo_france_data.scm_models_data.utils import Season
 def main():
     scm_study_class = SafranSnowfall1Day
     adamont_study_class = AdamontSnowfall
-    year_min = 1950
+    year_min = 2006
     year_max = 2100
     massif_names = ['Vanoise']
     season = Season.annual
     scenarios = rcm_scenarios_extended
-    # scenarios = rcp_scenarios
+    scenarios = rcp_scenarios
     altitudes = [600, 2100, 3600]
     for altitude, adamont_scenario in list(zip(altitudes, scenarios))[:]:
-        plt.figure(figsize=(20, 5))
+        plt.figure(figsize=(10, 5))
         # Loading part
         scm_study = scm_study_class(altitude=altitude)
         real_adamont_scenario = scenario_to_real_scenarios(adamont_scenario=adamont_scenario)[-1]
@@ -38,7 +38,7 @@ def main():
                                          season=season, scenario=adamont_scenario)
         print(altitude, adamont_scenario)
         adamont_studies.plot_maxima_time_series_adamont(massif_names=massif_names,
-                                                        scm_study=scm_study, legend_and_labels=False)
+                                                        scm_study=scm_study, legend_and_labels=True)
 
 
 if __name__ == '__main__':
-- 
GitLab