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') float_format='%g')
if output_diagnostics: 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 # Save probabilistic diagnostics
year_idx = year == years 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] 0, 100, 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', diag_basename + '.csv')
'{} {} {}.csv'.format(beach_scenario, year,
profile_type))
dump_df = dump_df[::100] # Only output every 100th row dump_df = dump_df[::100] # Only output every 100th row
dump_df.to_csv(csv_name, float_format='%g') 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) y=0.92)
if output_diagnostics: if output_diagnostics:
figname = os.path.join( figname = os.path.join('diagnostics',
'diagnostics', diag_basename + ' scatter.png')
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) 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['top'].set_visible(False)
a.spines['right'].set_visible(False) a.spines['right'].set_visible(False)
figname = os.path.join( figname = os.path.join('diagnostics',
'diagnostics', diag_basename + ' timeseries.png')
f'{beach_scenario} {profile_type} timeseries.png')
plt.savefig(figname, bbox_inches='tight', dpi=300) plt.savefig(figname, bbox_inches='tight', dpi=300)
plt.close(fig) plt.close(fig)

Loading…
Cancel
Save