From ce345ea89df14530481208970aeef5f650c501fb Mon Sep 17 00:00:00 2001 From: Dan Howe Date: Thu, 19 May 2022 02:43:56 +1000 Subject: [PATCH] Skip omitted profiles properly --- probabilistic-analysis/probabilistic_assessment.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/probabilistic-analysis/probabilistic_assessment.py b/probabilistic-analysis/probabilistic_assessment.py index f3cf624..55439d8 100644 --- a/probabilistic-analysis/probabilistic_assessment.py +++ b/probabilistic-analysis/probabilistic_assessment.py @@ -452,14 +452,19 @@ def process(beach_name, beach_scenario, n_runs, start_year, end_year, col_names = [c for c in df_in.columns if c.isdigit()] - # Loop through profiles - dff = df_in[df_in['beach'] == beach_name] + # Make sure blocks are always strings + df_omit = pd.DataFrame(omit) + df_omit['block'] = df_omit['block'].astype(str) + df_in['block'] = df_in['block'].astype(str) # Remove omitted profiles - dff = pd.merge( - pd.DataFrame(omit), dff, how='outer', + df_in = pd.merge( + df_omit, df_in, how='outer', indicator='source').query('source!="both"').drop(columns='source') + # Loop through profiles + dff = df_in[df_in['beach'] == beach_name] + pbar_profile = tqdm(dff.iterrows(), total=dff.shape[0], leave=False) for i, prof in pbar_profile: