|
|
@ -464,6 +464,12 @@ def process(beach_name, beach_scenario, n_runs, start_year, end_year,
|
|
|
|
figsize=(16, 24),
|
|
|
|
figsize=(16, 24),
|
|
|
|
sharey='row')
|
|
|
|
sharey='row')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Check whether to save probabilistic diagnostics
|
|
|
|
|
|
|
|
for _, bp in pd.DataFrame(diagnostics).iterrows():
|
|
|
|
|
|
|
|
if ((str(prof['block']) == str(bp['block']))
|
|
|
|
|
|
|
|
and (prof['profile'] == bp['profile'])):
|
|
|
|
|
|
|
|
output_diagnostics = True
|
|
|
|
|
|
|
|
|
|
|
|
# Loop through years
|
|
|
|
# Loop through years
|
|
|
|
pbar_year = tqdm(output_years, leave=False)
|
|
|
|
pbar_year = tqdm(output_years, leave=False)
|
|
|
|
for j, year in enumerate(pbar_year):
|
|
|
|
for j, year in enumerate(pbar_year):
|
|
|
@ -595,12 +601,7 @@ def process(beach_name, beach_scenario, n_runs, start_year, end_year,
|
|
|
|
header=False,
|
|
|
|
header=False,
|
|
|
|
float_format='%g')
|
|
|
|
float_format='%g')
|
|
|
|
|
|
|
|
|
|
|
|
# Check whether to save probabilistic diagnostics
|
|
|
|
if output_diagnostics:
|
|
|
|
for _, bp in pd.DataFrame(diagnostics).iterrows():
|
|
|
|
|
|
|
|
if not ((str(prof['block']) == str(bp['block'])) and
|
|
|
|
|
|
|
|
(prof['profile'] == bp['profile'])):
|
|
|
|
|
|
|
|
continue # Don't save
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Save probabilistic diagnostics
|
|
|
|
# Save probabilistic diagnostics
|
|
|
|
year_idx = year == years
|
|
|
|
year_idx = year == years
|
|
|
|
|
|
|
|
|
|
|
@ -657,15 +658,14 @@ def process(beach_name, beach_scenario, n_runs, start_year, end_year,
|
|
|
|
ascending=False)
|
|
|
|
ascending=False)
|
|
|
|
|
|
|
|
|
|
|
|
# Add encounter probabilities
|
|
|
|
# Add encounter probabilities
|
|
|
|
dump_df['Encounter probability (%)'] = np.linspace(0,
|
|
|
|
dump_df['Encounter probability (%)'] = np.linspace(
|
|
|
|
100,
|
|
|
|
0, 100, num=n_runs + 2)[1:-1]
|
|
|
|
num=n_runs +
|
|
|
|
|
|
|
|
2)[1:-1]
|
|
|
|
|
|
|
|
dump_df = dump_df.set_index('Encounter probability (%)')
|
|
|
|
dump_df = dump_df.set_index('Encounter probability (%)')
|
|
|
|
|
|
|
|
|
|
|
|
csv_name = os.path.join(
|
|
|
|
csv_name = os.path.join(
|
|
|
|
'diagnostics',
|
|
|
|
'diagnostics',
|
|
|
|
'{} {} {}.csv'.format(beach_scenario, year, profile_type))
|
|
|
|
'{} {} {}.csv'.format(beach_scenario, year,
|
|
|
|
|
|
|
|
profile_type))
|
|
|
|
dump_df.to_csv(csv_name, float_format='%g')
|
|
|
|
dump_df.to_csv(csv_name, float_format='%g')
|
|
|
|
|
|
|
|
|
|
|
|
for i, c in enumerate(dump_df.columns[3:]):
|
|
|
|
for i, c in enumerate(dump_df.columns[3:]):
|
|
|
@ -679,19 +679,24 @@ def process(beach_name, beach_scenario, n_runs, start_year, end_year,
|
|
|
|
if j == 0:
|
|
|
|
if j == 0:
|
|
|
|
ax[i, 0].yaxis.set_label_coords(-0.4, 0.5)
|
|
|
|
ax[i, 0].yaxis.set_label_coords(-0.4, 0.5)
|
|
|
|
label = c.replace('(', '\n(')
|
|
|
|
label = c.replace('(', '\n(')
|
|
|
|
ax[i, 0].set_ylabel(label, va='top', linespacing=1.5)
|
|
|
|
ax[i, 0].set_ylabel(label,
|
|
|
|
|
|
|
|
va='top',
|
|
|
|
|
|
|
|
linespacing=1.5)
|
|
|
|
|
|
|
|
|
|
|
|
ax[i, j].set_xlabel('Encounter probability (%)', labelpad=10)
|
|
|
|
ax[i, j].set_xlabel('Encounter probability (%)',
|
|
|
|
|
|
|
|
labelpad=10)
|
|
|
|
ax[0, j].set_title(year)
|
|
|
|
ax[0, j].set_title(year)
|
|
|
|
|
|
|
|
|
|
|
|
fig.suptitle('{}, block {}, profile {}'.format(
|
|
|
|
fig.suptitle('{}, block {}, profile {}'.format(
|
|
|
|
beach_scenario, prof['block'], prof['profile']),
|
|
|
|
beach_scenario, prof['block'], prof['profile']),
|
|
|
|
y=0.92)
|
|
|
|
y=0.92)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if output_diagnostics:
|
|
|
|
figname = os.path.join(
|
|
|
|
figname = os.path.join(
|
|
|
|
'diagnostics', '{} {}.png'.format(beach_scenario,
|
|
|
|
'diagnostics',
|
|
|
|
profile_type))
|
|
|
|
f'{beach_scenario} {profile_type} scatter.png')
|
|
|
|
plt.savefig(figname, bbox_inches='tight', dpi=300)
|
|
|
|
plt.savefig(figname, bbox_inches='tight', dpi=300)
|
|
|
|
|
|
|
|
plt.close(fig)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
def main():
|
|
|
|