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

[contrasting] add main_altitudes_studies.py

parent 961dc387
No related merge requests found
Showing with 22 additions and 7 deletions
+22 -7
......@@ -89,7 +89,7 @@ class AltitudesStudies(object):
def show_or_save_to_file(self, plot_name, show=False):
study_visualizer = StudyVisualizer(study=self.study, show=show, save_to_file=not show)
study_visualizer.plot_name = plot_name
study_visualizer.show_or_save_to_file(add_classic_title=False)
study_visualizer.show_or_save_to_file(add_classic_title=False, dpi=500)
def plot_maxima_time_series(self, massif_names=None, show=False):
massif_names = massif_names if massif_names is not None else self.study.all_massif_names()
......@@ -99,16 +99,16 @@ class AltitudesStudies(object):
def _plot_maxima_time_series(self, massif_name, show=False):
ax = plt.gca()
linewidth = 5
x = self.study.ordered_years
for altitude, study in self.altitude_to_study.items():
y = study.massif_name_to_annual_maxima[massif_name]
label = '{} m'.format(altitude)
ax.plot(x, y, linewidth=linewidth, label=label)
for altitude, study in list(self.altitude_to_study.items())[::-1]:
if massif_name in study.massif_name_to_annual_maxima:
y = study.massif_name_to_annual_maxima[massif_name]
label = '{} m'.format(altitude)
ax.plot(x, y, linewidth=2, label=label)
ax.xaxis.set_ticks(x[1::10])
ax.tick_params(axis='both', which='major', labelsize=13)
ax.legend()
plot_name = 'Annual maxima of {} in {}'.format(SCM_STUDY_CLASS_TO_ABBREVIATION[self.study_class], massif_name)
plot_name = 'Annual maxima of {}\nin {}'.format(SCM_STUDY_CLASS_TO_ABBREVIATION[self.study_class], massif_name)
ax.set_ylabel('{} ({})'.format(plot_name, self.study.variable_unit), fontsize=15)
ax.set_xlabel('years', fontsize=15)
self.show_or_save_to_file(plot_name=plot_name, show=show)
......
from extreme_data.meteo_france_data.scm_models_data.safran.safran import SafranSnowfall1Day
from projects.contrasting_trends_in_snow_loads.altitudes_fit.altitudes_studies import AltitudesStudies
def main_plots():
altitudes = [900, 1200, 1500, 1800, 2100, 2400, 2700, 3000]
study_class = SafranSnowfall1Day
studies = AltitudesStudies(study_class, altitudes)
# massifs_names = ['Vercors']
# studies.plot_maxima_time_series(massif_names=massifs_names)
studies.plot_maxima_time_series()
if __name__ == '__main__':
main_plots()
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