@ -2,8 +2,9 @@
#####################################----------------------------------
#####################################----------------------------------
#Last Updated - March 2018
#Last Updated - March 2018
#@author: z5025317 Valentin Heimhuber
#@author: z5025317 Valentin Heimhuber
#code for creating climate prioritization plots for NARCLIM variables.
#code for creating future climate variability deviation plots for NARCLIM variables.
#Inputs: Uses CSV files that contain all 12 NARCLIM model runs time series for 1 grid cell created with: P1_NARCliM_NC_to_CSV_CCRC_SS.py
#Inputs: Uses CSV files that containthe deltas of all 12 NARCLIM models for 1 grid cell at the site of interest, generated with P1_NARCLIM_plots_Windows.py
#This code is used only for the NARCLIM variables - a separate code is used for ocean variables etc that are not part of the NARCLIM ensemble
#####################################----------------------------------
#####################################----------------------------------
#Load packages
#Load packages
#####################################----------------------------------
#####################################----------------------------------
@ -27,10 +28,10 @@ os.chdir('C:/Users/z5025317/WRL_Postdoc/Projects/Paper#1/')
#set input parameters
#set input parameters
Base_period_start = ' 1986-01-01 '
Base_period_start = ' 1986-01-01 '
Base_period_end = ' 2005-01-01 ' #use last day that's not included in period as < is used for subsetting
Base_period_end = ' 2005-01-01 ' #use last day that's not included in period as < is used for subsetting
Estuary = ' T weed ' # 'Belongil'
Estuary = ' T errigal ' # 'Belongil'
Clim_var_type = " * " # '*' will create pdf for all variables in folder
Clim_var_type = " * " # '*' will create pdf for all variables in folder
Clim_var_type = " tasmax *" # '*' will create pdf for all variables in folder
Clim_var_type = " wssmean *" # '*' will create pdf for all variables in folder
Present_Day_Clim_Var = ' Rainfall'
Present_Day_Clim_Var = ' Wind' #MaxT, MinT, Rainfall, ET
#####################################----------------------------------
#####################################----------------------------------
#set directory path for output files
#set directory path for output files
@ -44,134 +45,164 @@ if not os.path.exists(output_directory):
print ( ' ------------------- ' )
print ( ' ------------------- ' )
Clim_Var_CSVs = glob . glob ( ' ./Output/ ' + Estuary + ' / ' + Estuary + ' _ ' + Clim_var_type + ' * ' )
Clim_Var_CSVs = glob . glob ( ' ./Output/ ' + Estuary + ' / ' + Estuary + ' _ ' + Clim_var_type + ' * ' )
#read CSV file
#read CSV file
for clim_var_csv_path in Clim_Var_CSVs :
clim_var_csv_path = Clim_Var_CSVs [ 0 ]
Filename = os . path . basename ( os . path . normpath ( clim_var_csv_path ) )
Filename = os . path . basename ( os . path . normpath ( clim_var_csv_path ) )
Clim_var_type = Filename . split ( ' _ ' , 2 ) [ 1 ]
Clim_var_type = Filename . split ( ' _ ' , 2 ) [ 1 ]
print ( Clim_var_type )
print ( Clim_var_type )
Ensemble_Delta_full_df = pd . read_csv ( clim_var_csv_path , index_col = 0 , parse_dates = True )
Ensemble_Delta_full_df = pd . read_csv ( clim_var_csv_path , index_col = 0 , parse_dates = True )
#Ensemble_Delta_full_df = pd.to_numeric(Ensemble_Delta_full_df)
#Ensemble_Delta_full_df = pd.to_numeric(Ensemble_Delta_full_df)
#
#load present day climate data for the same variable
#load present day climate data for the same variable
if Clim_var_type == ' evspsblmean ' : #ET time series that we have is not in the same format as the other variables, hence the different treatment
Present_day_Var_CSV = glob . glob ( ' ./Data/Wheather_Station_Data/**/ ' + Estuary + ' _ ' + Present_Day_Clim_Var + ' *csv ' )
Present_day_Var_CSV = glob . glob ( ' ./Data/Wheather_Station_Data/**/ ' + Estuary + ' _ ' + Present_Day_Clim_Var + ' *csv ' )
Present_day_df = pd . read_csv ( Present_day_Var_CSV [ 0 ] )
Present_day_df = pd . read_csv ( Present_day_Var_CSV [ 0 ] )
if Clim_var_type == ' evspsblmean ' :
Dates = pd . to_datetime ( Present_day_df . Date )
Dates = pd . to_datetime ( Present_day_df . Date )
Present_day_df . index = Dates
Present_day_df . index = Dates
Present_day_df = Present_day_df . iloc [ : , 1 ]
Present_day_df = Present_day_df . iloc [ : , 1 ]
Present_day_df = Present_day_df . replace ( r ' \ s+ ' , np . nan , regex = True )
Present_day_df = Present_day_df . replace ( r ' \ s+ ' , np . nan , regex = True )
Present_day_df = pd . to_numeric ( Present_day_df )
Present_day_df = pd . to_numeric ( Present_day_df )
Present_day_df . index = Dates
[ minplotDelta , maxplotDelta ] = [ 50 , 50 ]
else :
#for tasmean, observed min and max T need to be converted into mean T
Dates = pd . to_datetime ( Present_day_df . Year * 10000 + Present_day_df . Month * 100 + Present_day_df . Day , format = ' % Y % m %d ' )
elif Clim_var_type == ' tasmean ' :
Present_day_df . index = Dates
Present_day_Var_CSV = glob . glob ( ' ./Data/Wheather_Station_Data/**/ ' + Estuary + ' _MaxT*csv ' )
Present_day_df = Present_day_df . iloc [ : , 5 ]
Present_day_df = pd . read_csv ( Present_day_Var_CSV [ 0 ] )
#create seasonal sums etc.
Dates = pd . to_datetime ( Present_day_df . Year * 10000 + Present_day_df . Month * 100 + Present_day_df . Day , format = ' % Y % m %d ' )
if ( Clim_var_type == ' pracc ' or Clim_var_type == ' evspsblmean ' or Clim_var_type == ' potevpmean '
Present_day_df . index = Dates
or Clim_var_type == ' pr1Hmaxtstep ' or Clim_var_type == ' wss1Hmaxtstep ' ) :
Present_day_MaxT_df = Present_day_df . iloc [ : , 5 ]
Present_day_df_annual = Present_day_df . resample ( ' A ' ) . sum ( )
Present_day_Var_CSV = glob . glob ( ' ./Data/Wheather_Station_Data/**/ ' + Estuary + ' _MinT*csv ' )
Present_day_df_annual = Present_day_df_annual . replace ( 0 , np . nan )
Present_day_df = pd . read_csv ( Present_day_Var_CSV [ 0 ] )
Present_day_df_monthly = Present_day_df . resample ( ' M ' ) . sum ( )
Dates = pd . to_datetime ( Present_day_df . Year * 10000 + Present_day_df . Month * 100 + Present_day_df . Day , format = ' % Y % m %d ' )
Present_day_df_monthly = Present_day_df_monthly . replace ( 0 , np . nan )
Present_day_df . index = Dates
Present_day_df_weekly = Present_day_df . resample ( ' W ' ) . sum ( )
Present_day_MinT_df = Present_day_df . iloc [ : , 5 ]
Present_day_df_weekly = Present_day_df_weekly . replace ( 0 , np . nan )
Present_day_df = ( Present_day_MaxT_df + Present_day_MinT_df ) / 2
Fdf_Seas_means = Present_day_df . resample ( ' Q-NOV ' ) . sum ( ) #seasonal means
[ minplotDelta , maxplotDelta ] = [ 1 , 2 ]
Fdf_Seas_means = Fdf_Seas_means . replace ( 0 , np . nan )
elif Clim_var_type == ' tasmax ' :
else :
[ minplotDelta , maxplotDelta ] = [ 1 , 2 ]
Present_day_df_annual = Present_day_df . resample ( ' A ' ) . mean ( )
elif Clim_var_type == ' wssmean ' or Clim_var_type == ' wss1Hmaxtstep ' :
Present_day_df_monthly = Present_day_df . resample ( ' M ' ) . mean ( )
Present_day_Var_CSV = glob . glob ( ' ./Data/Wheather_Station_Data/**/ ' + Estuary + ' _ ' + Present_Day_Clim_Var + ' *csv ' )
Present_day_df_weekly = Present_day_df . resample ( ' W ' ) . mean ( )
Present_day_df = pd . read_csv ( Present_day_Var_CSV [ 0 ] )
Fdf_Seas_means = Present_day_df . resample ( ' Q-NOV ' ) . mean ( ) #seasonal means
Present_day_df . index = Present_day_df [ [ ' Year ' , ' Month ' , ' Day ' , ' Hour ' ] ] . apply ( lambda s : datetime ( * s ) , axis = 1 )
Present_day_df = Present_day_df . filter ( regex = ' m/s ' )
#Loop through annual and seasons and create a deviation plot for each.
Present_day_df = Present_day_df . replace ( r ' \ s+ ' , np . nan , regex = True )
times = [ ' annual ' , ' DJF ' , ' MAM ' , ' JJA ' , ' SON ' ]
Present_day_df [ ' Wind speed measured in m/s ' ] = Present_day_df [ ' Wind speed measured in m/s ' ] . convert_objects ( convert_numeric = True )
fig = plt . figure ( figsize = ( 14 , 8 ) )
[ minplotDelta , maxplotDelta ] = [ 1 , 1.5 ]
delta_all_df = pd . DataFrame ( )
else :
i = 1
Present_day_Var_CSV = glob . glob ( ' ./Data/Wheather_Station_Data/**/ ' + Estuary + ' _ ' + Present_Day_Clim_Var + ' *csv ' )
for temp in times :
Present_day_df = pd . read_csv ( Present_day_Var_CSV [ 0 ] )
#subset the ensemble dataframe for the period used:
Dates = pd . to_datetime ( Present_day_df . Year * 10000 + Present_day_df . Month * 100 + Present_day_df . Day , format = ' % Y % m %d ' )
if temp == ' annual ' :
Present_day_df . index = Dates
Ensemble_Delta_df = Ensemble_Delta_full_df . iloc [ : , range ( 0 , 2 ) ]
Present_day_df = Present_day_df . iloc [ : , 5 ]
#
[ minplotDelta , maxplotDelta ] = [ 50 , 50 ]
Present_Day_ref_df = Present_day_df_annual
#create seasonal sums etc.
else :
if ( Clim_var_type == ' pracc ' or Clim_var_type == ' evspsblmean ' or Clim_var_type == ' potevpmean '
Ensemble_Delta_df = Ensemble_Delta_full_df . filter ( regex = temp )
or Clim_var_type == ' pr1Hmaxtstep ' or Clim_var_type == ' wss1Hmaxtstep ' ) :
Ensemble_Delta_df . columns = [ ' near ' , ' far ' ]
Present_day_df_annual = Present_day_df . resample ( ' A ' ) . sum ( )
if temp == ' DJF ' :
Present_day_df_annual = Present_day_df_annual . replace ( 0 , np . nan )
Mean_df = Fdf_Seas_means [ Fdf_Seas_means . index . quarter == 1 ]
Present_day_df_monthly = Present_day_df . resample ( ' M ' ) . sum ( )
Column_names = [ ' DJF_near ' , ' DJF_far ' ]
Present_day_df_monthly = Present_day_df_monthly . replace ( 0 , np . nan )
if temp == ' MAM ' :
Present_day_df_weekly = Present_day_df . resample ( ' W ' ) . sum ( )
Mean_df = Fdf_Seas_means [ Fdf_Seas_means . index . quarter == 2 ]
Present_day_df_weekly = Present_day_df_weekly . replace ( 0 , np . nan )
Column_names = [ ' MAM_near ' , ' MAM_far ' ]
Fdf_Seas_means = Present_day_df . resample ( ' Q-NOV ' ) . sum ( ) #seasonal means
if temp == ' JJA ' :
Fdf_Seas_means = Fdf_Seas_means . replace ( 0 , np . nan )
Mean_df = Fdf_Seas_means [ Fdf_Seas_means . index . quarter == 3 ]
else :
Column_names = [ ' JJA_near ' , ' JJA_far ' ]
Present_day_df_annual = Present_day_df . resample ( ' A ' ) . mean ( )
if temp == ' SON ' :
Present_day_df_monthly = Present_day_df . resample ( ' M ' ) . mean ( )
Mean_df = Fdf_Seas_means [ Fdf_Seas_means . index . quarter == 4 ]
Present_day_df_weekly = Present_day_df . resample ( ' W ' ) . mean ( )
Present_Day_ref_df = Mean_df
Fdf_Seas_means = Present_day_df . resample ( ' Q-NOV ' ) . mean ( ) #seasonal means
print ( Ensemble_Delta_df . columns . values )
#Subset to present day variability period
#Loop through annual and seasons and create a deviation plot for each.
Present_Day_ref_df = pd . DataFrame ( Present_Day_ref_df . loc [ ( Present_Day_ref_df . index > = Base_period_start ) & ( Present_Day_ref_df . index < = Base_period_end ) ] )
times = [ ' annual ' , ' DJF ' , ' MAM ' , ' JJA ' , ' SON ' ]
Present_Day_Mean = np . percentile ( Present_Day_ref_df , 50 )
fig = plt . figure ( figsize = ( 14 , 8 ) )
Present_Day_SD = np . std ( Present_Day_ref_df )
delta_all_df = pd . DataFrame ( )
#create data frame for floating stacked barplots
i = 1
index = [ ' -2std ' , ' -1std ' , ' Med ' , ' 1std ' , ' 2std ' ]
for temp in times :
columns = [ ' present ' , ' near future ' , ' far future ' ]
#subset the ensemble dataframe for the period used:
Plot_in_df = pd . DataFrame ( index = index , columns = columns )
if temp == ' annual ' :
Ensemble_Delta_df = Ensemble_Delta_full_df . iloc [ : , range ( 0 , 2 ) ]
#
#
Plot_in_df [ ' present ' ] = [ float ( Present_Day_Mean - 2 * Present_Day_SD ) , float ( Present_Day_Mean - Present_Day_SD ) , float ( Present_Day_Mean ) ,
Present_Day_ref_df = Present_day_df_annual
float ( Present_Day_Mean + Present_Day_SD ) , float ( Present_Day_Mean + 2 * Present_Day_SD ) ]
else :
Plot_in_df [ ' near future ' ] = [ float ( Present_Day_Mean + Ensemble_Delta_df . near [ - 3 : ] [ 0 ] ) , np . NaN , float ( Present_Day_Mean + Ensemble_Delta_df . near [ - 3 : ] [ 1 ] ) ,
Ensemble_Delta_df = Ensemble_Delta_full_df . filter ( regex = temp )
np . NaN , float ( Present_Day_Mean + Ensemble_Delta_df . near [ - 3 : ] [ 2 ] ) ]
Ensemble_Delta_df . columns = [ ' near ' , ' far ' ]
Plot_in_df [ ' far future ' ] = [ float ( Present_Day_Mean + Ensemble_Delta_df . far [ - 3 : ] [ 0 ] ) , np . NaN , float ( Present_Day_Mean + Ensemble_Delta_df . far [ - 3 : ] [ 1 ] ) ,
if temp == ' DJF ' :
np . NaN , float ( Present_Day_Mean + Ensemble_Delta_df . far [ - 3 : ] [ 2 ] ) ]
Mean_df = Fdf_Seas_means [ Fdf_Seas_means . index . quarter == 1 ]
#Create a second data frame that has the values in a way that they can be stacked up in bars with the correct absolute values
Column_names = [ ' DJF_near ' , ' DJF_far ' ]
Plot_in_df2 = pd . DataFrame ( index = index , columns = columns )
Plot_in_df2 [ ' present ' ] = [ float ( Present_Day_Mean - 2 * Present_Day_SD ) , float ( Present_Day_SD ) , float ( Present_Day_SD ) ,
float ( Present_Day_SD ) , float ( Present_Day_SD ) ]
Plot_in_df2 [ ' near future ' ] = [ float ( Present_Day_Mean + Ensemble_Delta_df . near [ - 3 : ] [ 0 ] ) , np . NaN , float ( Ensemble_Delta_df . near [ - 3 : ] [ 1 ] - Ensemble_Delta_df . near [ - 3 : ] [ 0 ] ) ,
np . NaN , float ( Ensemble_Delta_df . near [ - 3 : ] [ 2 ] - Ensemble_Delta_df . near [ - 3 : ] [ 1 ] ) ]
Plot_in_df2 [ ' far future ' ] = [ float ( Present_Day_Mean + Ensemble_Delta_df . far [ - 3 : ] [ 0 ] ) , np . NaN , float ( Ensemble_Delta_df . far [ - 3 : ] [ 1 ] - Ensemble_Delta_df . far [ - 3 : ] [ 0 ] ) ,
np . NaN , float ( Ensemble_Delta_df . far [ - 3 : ] [ 2 ] - Ensemble_Delta_df . far [ - 3 : ] [ 1 ] ) ]
#transpose the data frame
Plot_in_df_tp = Plot_in_df2 . transpose ( )
#do the individual plots
if temp == ' annual ' :
xmin = int ( min ( Plot_in_df . min ( axis = 1 ) ) - 1 )
xmax = int ( max ( Plot_in_df . max ( axis = 1 ) ) + 2 )
else :
xmin = int ( min ( Plot_in_df . min ( axis = 1 ) ) - 1 )
xmax = int ( max ( Plot_in_df . max ( axis = 1 ) ) + 2 )
#define colour scheme
#likert_colors = ['none', 'firebrick','firebrick','lightcoral','lightcoral']
likert_colors = [ ' none ' , ' darkblue ' , ' darkblue ' , ' cornflowerblue ' , ' cornflowerblue ' ]
#plot the stacked barplot
ax = plt . subplot ( 2 , 3 , i )
Plot_in_df_tp . plot . bar ( stacked = True , color = likert_colors , edgecolor = ' none ' , legend = False , ax = ax )
z = plt . axhline ( float ( Present_Day_Mean - 2 * Present_Day_SD ) , linestyle = ' - ' , color = ' black ' , alpha = .5 )
z . set_zorder ( - 1 )
z = plt . axhline ( float ( Present_Day_Mean + 2 * Present_Day_SD ) , linestyle = ' - ' , color = ' black ' , alpha = .5 )
z . set_zorder ( - 1 )
z = plt . axhline ( float ( Present_Day_Mean - Present_Day_SD ) , linestyle = ' -- ' , color = ' black ' , alpha = .5 )
z . set_zorder ( - 1 )
z = plt . axhline ( float ( Present_Day_Mean + Present_Day_SD ) , linestyle = ' -- ' , color = ' black ' , alpha = .5 )
z . set_zorder ( - 1 )
plt . ylim ( xmin , xmax )
plt . title ( Clim_var_type + ' ' + temp )
ax . grid ( False )
for tick in ax . get_xticklabels ( ) :
tick . set_rotation ( 0 )
fig . tight_layout ( )
#reset i to i+1 for next step
if temp == ' MAM ' :
if temp == ' MAM ' :
i = i + 2
Mean_df = Fdf_Seas_means [ Fdf_Seas_means . index . quarter == 2 ]
else :
Column_names = [ ' MAM_near ' , ' MAM_far ' ]
i = i + 1
if temp == ' JJA ' :
print ( i )
Mean_df = Fdf_Seas_means [ Fdf_Seas_means . index . quarter == 3 ]
plt . show ( )
Column_names = [ ' JJA_near ' , ' JJA_far ' ]
out_file_name = Estuary + ' _ ' + Clim_var_type + ' _CC_prio_plot.png '
if temp == ' SON ' :
out_path = output_directory + ' / ' + out_file_name
Mean_df = Fdf_Seas_means [ Fdf_Seas_means . index . quarter == 4 ]
fig . savefig ( out_path )
Present_Day_ref_df = Mean_df
print ( Ensemble_Delta_df . columns . values )
#Subset to present day variability period
Present_Day_ref_df = pd . DataFrame ( Present_Day_ref_df . loc [ ( Present_Day_ref_df . index > = Base_period_start ) & ( Present_Day_ref_df . index < = Base_period_end ) ] )
Present_Day_Mean = np . percentile ( Present_Day_ref_df , 50 )
Present_Day_SD = np . std ( Present_Day_ref_df )
#create data frame for floating stacked barplots
index = [ ' -2std ' , ' -1std ' , ' Med ' , ' 1std ' , ' 2std ' ]
columns = [ ' present ' , ' near future ' , ' far future ' ]
Plot_in_df = pd . DataFrame ( index = index , columns = columns )
#
Plot_in_df [ ' present ' ] = [ float ( Present_Day_Mean - 2 * Present_Day_SD ) , float ( Present_Day_Mean - Present_Day_SD ) , float ( Present_Day_Mean ) ,
float ( Present_Day_Mean + Present_Day_SD ) , float ( Present_Day_Mean + 2 * Present_Day_SD ) ]
Plot_in_df [ ' near future ' ] = [ float ( Present_Day_Mean + Ensemble_Delta_df . near [ - 3 : ] [ 0 ] ) , np . NaN , float ( Present_Day_Mean + Ensemble_Delta_df . near [ - 3 : ] [ 1 ] ) ,
np . NaN , float ( Present_Day_Mean + Ensemble_Delta_df . near [ - 3 : ] [ 2 ] ) ]
Plot_in_df [ ' far future ' ] = [ float ( Present_Day_Mean + Ensemble_Delta_df . far [ - 3 : ] [ 0 ] ) , np . NaN , float ( Present_Day_Mean + Ensemble_Delta_df . far [ - 3 : ] [ 1 ] ) ,
np . NaN , float ( Present_Day_Mean + Ensemble_Delta_df . far [ - 3 : ] [ 2 ] ) ]
#Create a second data frame that has the values in a way that they can be stacked up in bars with the correct absolute values
Plot_in_df2 = pd . DataFrame ( index = index , columns = columns )
Plot_in_df2 [ ' present ' ] = [ float ( Present_Day_Mean - 2 * Present_Day_SD ) , float ( Present_Day_SD ) , float ( Present_Day_SD ) ,
float ( Present_Day_SD ) , float ( Present_Day_SD ) ]
Plot_in_df2 [ ' near future ' ] = [ float ( Present_Day_Mean + Ensemble_Delta_df . near [ - 3 : ] [ 0 ] ) , np . NaN , float ( Ensemble_Delta_df . near [ - 3 : ] [ 1 ] - Ensemble_Delta_df . near [ - 3 : ] [ 0 ] ) ,
np . NaN , float ( Ensemble_Delta_df . near [ - 3 : ] [ 2 ] - Ensemble_Delta_df . near [ - 3 : ] [ 1 ] ) ]
Plot_in_df2 [ ' far future ' ] = [ float ( Present_Day_Mean + Ensemble_Delta_df . far [ - 3 : ] [ 0 ] ) , np . NaN , float ( Ensemble_Delta_df . far [ - 3 : ] [ 1 ] - Ensemble_Delta_df . far [ - 3 : ] [ 0 ] ) ,
np . NaN , float ( Ensemble_Delta_df . far [ - 3 : ] [ 2 ] - Ensemble_Delta_df . far [ - 3 : ] [ 1 ] ) ]
#transpose the data frame
Plot_in_df_tp = Plot_in_df2 . transpose ( )
#do the individual plots
if temp == ' annual ' :
xmin = int ( min ( Plot_in_df . min ( axis = 1 ) ) - minplotDelta )
xmax = int ( max ( Plot_in_df . max ( axis = 1 ) ) + maxplotDelta )
else :
xmin = int ( min ( Plot_in_df . min ( axis = 1 ) ) - minplotDelta )
xmax = int ( max ( Plot_in_df . max ( axis = 1 ) ) + maxplotDelta )
#define colour scheme
#likert_colors = ['none', 'firebrick','firebrick','lightcoral','lightcoral']
likert_colors = [ ' none ' , ' darkblue ' , ' darkblue ' , ' cornflowerblue ' , ' cornflowerblue ' ]
#plot the stacked barplot
ax = plt . subplot ( 2 , 3 , i )
Plot_in_df_tp . plot . bar ( stacked = True , color = likert_colors , edgecolor = ' none ' , legend = False , ax = ax )
z = plt . axhline ( float ( Present_Day_Mean - 2 * Present_Day_SD ) , linestyle = ' - ' , color = ' black ' , alpha = .5 )
z . set_zorder ( - 1 )
z = plt . axhline ( float ( Present_Day_Mean + 2 * Present_Day_SD ) , linestyle = ' - ' , color = ' black ' , alpha = .5 )
z . set_zorder ( - 1 )
z = plt . axhline ( float ( Present_Day_Mean - Present_Day_SD ) , linestyle = ' -- ' , color = ' black ' , alpha = .5 )
z . set_zorder ( - 1 )
z = plt . axhline ( float ( Present_Day_Mean + Present_Day_SD ) , linestyle = ' -- ' , color = ' black ' , alpha = .5 )
z . set_zorder ( - 1 )
z = plt . axhline ( float ( Present_Day_Mean ) , linestyle = ' -- ' , color = ' red ' , alpha = .5 )
z . set_zorder ( - 1 )
plt . ylim ( xmin , xmax )
plt . title ( Clim_var_type + ' ' + temp )
ax . grid ( False )
for tick in ax . get_xticklabels ( ) :
tick . set_rotation ( 0 )
fig . tight_layout ( )
#reset i to i+1 for next step
if temp == ' MAM ' :
i = i + 2
else :
i = i + 1
print ( i )
plt . show ( )
out_file_name = Estuary + ' _ ' + Clim_var_type + ' _CC_prio_plot.png '
out_path = output_directory + ' / ' + out_file_name
fig . savefig ( out_path )