Add profile and block IDs to diagnostic output files

master
Dan Howe 3 years ago
parent c22416f1bc
commit 53da693e9e

@ -624,6 +624,12 @@ def process(beach_name, beach_scenario, n_runs, start_year, end_year,
float_format='%g')
if output_diagnostics:
# Generate basename for diagnostic files
diag_basename = (f"{beach_scenario} "
f"{profile_type} "
f"block-{prof['block']} "
f"profile-{prof['profile']}")
# Save probabilistic diagnostics
year_idx = year == years
@ -684,10 +690,8 @@ def process(beach_name, beach_scenario, n_runs, start_year, end_year,
0, 100, num=n_runs + 2)[1:-1]
dump_df = dump_df.set_index('Encounter probability (%)')
csv_name = os.path.join(
'diagnostics',
'{} {} {}.csv'.format(beach_scenario, year,
profile_type))
csv_name = os.path.join('diagnostics',
diag_basename + '.csv')
dump_df = dump_df[::100] # Only output every 100th row
dump_df.to_csv(csv_name, float_format='%g')
@ -716,9 +720,8 @@ def process(beach_name, beach_scenario, n_runs, start_year, end_year,
y=0.92)
if output_diagnostics:
figname = os.path.join(
'diagnostics',
f'{beach_scenario} {profile_type} scatter.png')
figname = os.path.join('diagnostics',
diag_basename + ' scatter.png')
plt.savefig(figname, bbox_inches='tight', dpi=300)
plt.close(fig)
@ -825,9 +828,8 @@ def process(beach_name, beach_scenario, n_runs, start_year, end_year,
a.spines['top'].set_visible(False)
a.spines['right'].set_visible(False)
figname = os.path.join(
'diagnostics',
f'{beach_scenario} {profile_type} timeseries.png')
figname = os.path.join('diagnostics',
diag_basename + ' timeseries.png')
plt.savefig(figname, bbox_inches='tight', dpi=300)
plt.close(fig)

Loading…
Cancel
Save