From af56cbe03115400fee436a8873f6bf4c766b5d32 Mon Sep 17 00:00:00 2001 From: Dan Howe Date: Fri, 6 May 2022 13:35:33 +0200 Subject: [PATCH] Only save selected profiles --- probabilistic-analysis/probabilistic_assessment.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/probabilistic-analysis/probabilistic_assessment.py b/probabilistic-analysis/probabilistic_assessment.py index ee6858d..5549709 100644 --- a/probabilistic-analysis/probabilistic_assessment.py +++ b/probabilistic-analysis/probabilistic_assessment.py @@ -485,8 +485,7 @@ def process(beach_name, beach_scenario, n_runs, start_year, end_year, df_out = df_out.assign(omit_from_shp=False) for b, p in zip(omit_from_shp['block'], omit_from_shp['profile']): - idx = (df_out['block'] == str(b)) & (df_out['profile'] - == p) + idx = (df_out['block'] == b) & (df_out['profile'] == p) df_out.loc[idx, 'omit_from_shp'] = True # Specify additional points to be included in shapefiles @@ -558,9 +557,6 @@ def process(beach_name, beach_scenario, n_runs, start_year, end_year, storm_demand_dist = zero_chainage - storm_demand_chainage - # Plot statistics once for each profile - year_idx = year == years - # Include additional points for shapefile df_csv = df_out[df_out['beach'] == beach_name] @@ -573,6 +569,9 @@ def process(beach_name, beach_scenario, n_runs, start_year, end_year, if df_out[df_out['beach'] == beach_name].index[0] == i: df_csv.loc[[], :].to_csv(csv_name, index=False) + # Only save points if they are going into shapefile + df_csv = df_csv[~df_csv['omit_from_shp'].astype(bool)] + # Append data for current profile df_csv[df_csv.index == i].to_csv(csv_name, mode='a',