py-ewr 2.3.8__py3-none-any.whl → 2.4.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- py_ewr/data_inputs.py +39 -12
- py_ewr/evaluate_EWRs.py +168 -221
- py_ewr/model_metadata/EWR_Sitelist_FIRM_20250718.csv +11 -2
- py_ewr/observed_handling.py +22 -5
- py_ewr/parameter_metadata/ewr_calc_config.json +71 -2
- py_ewr/parameter_metadata/objective_reference.csv +911 -0
- py_ewr/parameter_metadata/parameter_sheet.csv +3249 -3443
- py_ewr/scenario_handling.py +7 -7
- py_ewr/summarise_results.py +2 -2
- {py_ewr-2.3.8.dist-info → py_ewr-2.4.0.dist-info}/METADATA +22 -22
- py_ewr-2.4.0.dist-info/RECORD +19 -0
- {py_ewr-2.3.8.dist-info → py_ewr-2.4.0.dist-info}/WHEEL +1 -1
- py_ewr/parameter_metadata/objective_reference_NB_SA_WIM_NE_LACH_BIDG_MLD_ACT.csv +0 -806
- py_ewr/parameter_metadata/parameter_sheet_NB_SA_WIM_NE_LACH_BIDG_MLD_ACT.csv +0 -3127
- py_ewr/parameter_metadata/parameter_sheet_NB_SA_WIM_NE_LACH_BIDG_MLD_ACT_added_act_env.csv +0 -3188
- py_ewr-2.3.8.dist-info/RECORD +0 -21
- {py_ewr-2.3.8.dist-info → py_ewr-2.4.0.dist-info}/licenses/LICENSE +0 -0
- {py_ewr-2.3.8.dist-info → py_ewr-2.4.0.dist-info}/top_level.txt +0 -0
py_ewr/data_inputs.py
CHANGED
|
@@ -433,7 +433,7 @@ def get_barrage_level_gauges()-> dict:
|
|
|
433
433
|
dict: dictionary of level gauges associated with each barrage.
|
|
434
434
|
"""
|
|
435
435
|
|
|
436
|
-
level_barrage_gauges = {'
|
|
436
|
+
level_barrage_gauges = {'A4260524': ['A4260527','A4261133', 'A4260524', 'A4260574', 'A4260575' ],
|
|
437
437
|
'A4260633' : ['A4260633','A4261209', 'A4261165']}
|
|
438
438
|
|
|
439
439
|
return level_barrage_gauges
|
|
@@ -466,7 +466,7 @@ def get_vic_level_gauges()-> list:
|
|
|
466
466
|
|
|
467
467
|
|
|
468
468
|
def get_cllmm_gauges()->list:
|
|
469
|
-
return ["A4261002", "
|
|
469
|
+
return ["A4261002", "A4260524", "A4260633"]
|
|
470
470
|
|
|
471
471
|
|
|
472
472
|
def get_gauges(category: str, ewr_table_path: str = None) -> set:
|
|
@@ -542,16 +542,43 @@ def gauge_groups(parameter_sheet: pd.DataFrame) -> dict:
|
|
|
542
542
|
|
|
543
543
|
# def gauges_to_measurand()
|
|
544
544
|
|
|
545
|
-
def get_causal_ewr() -> dict:
|
|
546
545
|
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
546
|
+
def get_obj_mapping(
|
|
547
|
+
parameter_sheet_path=None,
|
|
548
|
+
objective_reference_path=None
|
|
549
|
+
) -> pd.DataFrame:
|
|
550
|
+
'''
|
|
551
|
+
Retrieves objective mapping and merges with parameter sheet on Gauge, Planning Unit, Code, and LTWPShortName
|
|
552
|
+
to create a longform table that lists the associations between each EWR and ecological objectives.
|
|
553
|
+
Returns a DataFrame with the merged result.
|
|
554
|
+
Args:
|
|
555
|
+
param_sheet_path (str) = file path to parameter sheet. If None, default parameter_sheet.csv inside the tool is selected
|
|
556
|
+
obj_ref_path (str) = file path to objective mapping csv. If Not, default objective_reference.csv inside EWR tool is selected
|
|
557
|
+
'''
|
|
558
|
+
param_sheet_cols = [
|
|
559
|
+
'PlanningUnitName', 'LTWPShortName', 'SWSDLName', 'State', 'Gauge', 'Code', 'EcoObj'
|
|
560
|
+
]
|
|
550
561
|
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
"obj2yrtarget":pd.read_csv(obj2yrtarget_path)
|
|
555
|
-
}
|
|
562
|
+
if not objective_reference_path:
|
|
563
|
+
objective_reference_path = os.path.join(BASE_PATH, "parameter_metadata/obj_reference.csv")
|
|
564
|
+
|
|
556
565
|
|
|
557
|
-
|
|
566
|
+
obj_ref = pd.read_csv(objective_reference_path)
|
|
567
|
+
|
|
568
|
+
|
|
569
|
+
okay_EWRs, _ = get_EWR_table(file_path=parameter_sheet_path)
|
|
570
|
+
okay_EWRs_sub = okay_EWRs[param_sheet_cols]
|
|
571
|
+
|
|
572
|
+
# Split 'EnvObj' by '+' and explode to long format
|
|
573
|
+
longform_ewr = okay_EWRs_sub.assign(
|
|
574
|
+
EnvObj=okay_EWRs_sub['EcoObj'].str.split('+')
|
|
575
|
+
).explode('EnvObj').drop_duplicates()
|
|
576
|
+
|
|
577
|
+
merged_df = longform_ewr.merge(
|
|
578
|
+
obj_ref,
|
|
579
|
+
left_on= ['LTWPShortName', 'PlanningUnitName', 'Gauge', 'Code', 'EcoObj', 'SWSDLName', 'State'],
|
|
580
|
+
right_on=['LTWPShortName', 'PlanningUnitName', 'Gauge', 'Code', 'EcoObj', 'SWSDLName', 'State'],
|
|
581
|
+
how='left'
|
|
582
|
+
)
|
|
583
|
+
|
|
584
|
+
return merged_df
|