@@ -313,6 +313,7 @@ def calc(self, force_reassign=False):
313313 def plot_imp_map (
314314 self ,
315315 run_datetime = None ,
316+ explain_str = None ,
316317 save_fig = True ,
317318 close_fig = False ,
318319 polygon_file = None ,
@@ -321,13 +322,17 @@ def plot_imp_map(
321322 figsize = (9 , 13 ),
322323 adapt_fontsize = True ,
323324 ):
324- """plot a map of the impacts
325+ """ plot a map of the impacts
325326
326327 Parameters
327328 ----------
328329 run_datetime : datetime.datetime, optional
329330 Select the used hazard by the run_datetime,
330331 default is first element of attribute run_datetime.
332+ explain_str : str, optional
333+ Short str which explains type of impact, explain_str is included
334+ in the title of the figure.
335+ default is 'mean building damage caused by wind'
331336 save_fig : bool, optional
332337 Figure is saved if True, folder is within your configurable
333338 save_dir and filename is derived from the method summary_str()
@@ -372,7 +377,7 @@ def plot_imp_map(
372377 "run_start" : (
373378 run_datetime .strftime ("%d.%m.%Y %HUTC +" ) + lead_time_str + "d"
374379 ),
375- "explain_text" : ( "mean building damage caused by wind" ) ,
380+ "explain_text" : "mean building damage caused by wind" if explain_str is None else explain_str ,
376381 "model_text" : "CLIMADA IMPACT" ,
377382 }
378383 fig , axes = self ._plot_imp_map (
@@ -526,15 +531,24 @@ def _plot_imp_map(
526531 return fig , axis_sub
527532
528533 def plot_hist (
529- self , run_datetime = None , save_fig = True , close_fig = False , figsize = (9 , 8 )
534+ self ,
535+ run_datetime = None ,
536+ explain_str = None ,
537+ save_fig = True ,
538+ close_fig = False ,
539+ figsize = (9 , 8 ),
530540 ):
531- """plot histogram of the forecasted impacts all ensemble members
541+ """ plot histogram of the forecasted impacts all ensemble members
532542
533543 Parameters
534544 ----------
535545 run_datetime : datetime.datetime, optional
536546 Select the used hazard by the run_datetime,
537547 default is first element of attribute run_datetime.
548+ explain_str : str, optional
549+ Short str which explains type of impact, explain_str is included
550+ in the title of the figure.
551+ default is 'total building damage'
538552 save_fig : bool, optional
539553 Figure is saved if True, folder is within your configurable
540554 save_dir and filename is derived from the method summary_str()
@@ -603,7 +617,7 @@ def plot_hist(
603617 axes .xaxis .set_ticks (x_ticks )
604618 axes .xaxis .set_ticklabels (x_ticklabels )
605619 plt .xticks (rotation = 15 , horizontalalignment = "right" )
606- plt .xlim ([(10 ** - 0.25 ) * bins [0 ], (10 ** 0.25 ) * bins [- 1 ]])
620+ plt .xlim ([(10 ** - 0.25 ) * bins [0 ], (10 ** 0.25 ) * bins [- 1 ]])
607621
608622 lead_time_str = "{:.0f}" .format (
609623 self .lead_time (run_datetime ).days
@@ -614,7 +628,7 @@ def plot_hist(
614628 "run_start" : (
615629 run_datetime .strftime ("%d.%m.%Y %HUTC +" ) + lead_time_str + "d"
616630 ),
617- "explain_text" : ("total building damage" ),
631+ "explain_text" : ("total building damage" ) if explain_str is None else explain_str ,
618632 "model_text" : "CLIMADA IMPACT" ,
619633 }
620634 title_position = {
@@ -656,8 +670,9 @@ def plot_hist(
656670 plt .text (
657671 0.75 ,
658672 0.85 ,
659- "mean damage:\n CHF "
660- + self ._number_to_str (self ._impact [haz_ind ].at_event .mean ()),
673+ "mean impact:\n "
674+ + self ._number_to_str (self ._impact [haz_ind ].at_event .mean ())
675+ + ' ' + self ._impact [haz_ind ].unit ,
661676 horizontalalignment = "center" ,
662677 verticalalignment = "center" ,
663678 transform = axes .transAxes ,
@@ -740,7 +755,7 @@ def plot_exceedence_prob(
740755 The default is (9, 13)
741756 adapt_fontsize : bool, optional
742757 If set to true, the size of the fonts will be adapted to the size of the figure.
743- Otherwise the default matplotlib font size is used. Default is True.
758+ Otherwise, the default matplotlib font size is used. Default is True.
744759
745760 Returns
746761 -------
@@ -750,10 +765,10 @@ def plot_exceedence_prob(
750765 if run_datetime is None :
751766 run_datetime = self .run_datetime [0 ]
752767 haz_ind = np .argwhere (np .isin (self .run_datetime , run_datetime ))[0 ][0 ]
753- wind_map_file_name = (
768+ exceedence_map_file_name = (
754769 self .summary_str (run_datetime ) + "_exceed_" + str (threshold ) + "_map.jpeg"
755770 )
756- wind_map_file_name_full = FORECAST_PLOT_DIR / wind_map_file_name
771+ exceedence_map_file_name_full = FORECAST_PLOT_DIR / exceedence_map_file_name
757772 lead_time_str = "{:.0f}" .format (
758773 self .lead_time (run_datetime ).days
759774 + self .lead_time (run_datetime ).seconds / 60 / 60 / 24
@@ -783,7 +798,7 @@ def plot_exceedence_prob(
783798 adapt_fontsize = adapt_fontsize ,
784799 )
785800 if save_fig :
786- plt .savefig (wind_map_file_name_full )
801+ plt .savefig (exceedence_map_file_name_full )
787802 if close_fig :
788803 plt .clf ()
789804 plt .close (fig )
@@ -974,7 +989,7 @@ def plot_warn_map(
974989 Figure is not drawn if True. The default is False.
975990 adapt_fontsize : bool, optional
976991 If set to true, the size of the fonts will be adapted to the size of the figure.
977- Otherwise the default matplotlib font size is used. Default is True.
992+ Otherwise, the default matplotlib font size is used. Default is True.
978993
979994 Returns
980995 -------
@@ -1086,7 +1101,7 @@ def _plot_warn(
10861101 decision_dict_functions [aggregation ] = np .mean
10871102 else :
10881103 raise ValueError (
1089- "Parameter area_aggregation of "
1104+ "Parameter " + aggregation + " of "
10901105 + "Forecast.plot_warn_map() must eiter be "
10911106 + "a float between [0..1], which "
10921107 + "specifys a quantile. or 'sum' or 'mean'."
0 commit comments