py-ewr 2.3.1__py3-none-any.whl → 2.3.2__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/evaluate_EWRs.py CHANGED
@@ -1148,33 +1148,37 @@ def barrage_level_handle(PU: str, gauge: str, EWR: str, EWR_table: pd.DataFrame,
1148
1148
  Returns:
1149
1149
  tuple[pd.DataFrame, tuple[dict]]: EWR results for the current planning unit iteration (updated); dictionary of EWR event information
1150
1150
  """
1151
+ print(df_L.head())
1151
1152
  barrage_level_gauges = data_inputs.get_barrage_level_gauges()
1152
1153
  all_required_gauges = barrage_level_gauges.get(gauge)
1154
+ # if all_required_gauges:
1155
+ # all_required_gauges_in_df_L = all(gauge in df_L.columns for gauge in all_required_gauges)
1153
1156
  if all_required_gauges:
1154
- all_required_gauges_in_df_L = all(gauge in df_L.columns for gauge in all_required_gauges)
1155
- # check if current gauge is the main barrage gauge
1156
- if all_required_gauges_in_df_L:
1157
- pull = data_inputs.get_EWR_components('barrage-level')
1158
- EWR_info = get_EWRs(PU, gauge, EWR, EWR_table, pull)
1159
- masked_dates = mask_dates(EWR_info, df_L)
1160
- # Extract a daily timeseries for water years:
1161
- water_years = wateryear_daily(df_L, EWR_info)
1162
- # If there is no level data loaded in, let user know and skip the analysis
1163
- df = df_L.copy(deep=True)
1164
- # calculate 5 day moving average and average of all required gauges
1165
- df_5_day_averages = calculate_n_day_moving_average(df,5)
1166
- df_5_day_averages['mean'] = df[all_required_gauges].mean(axis=1)
1167
- cllmm_type = what_cllmm_type(EWR_info)
1168
- if cllmm_type == 'c':
1169
- E, D = lower_lakes_level_calc(EWR_info, df_5_day_averages['mean'], water_years, df_L.index, masked_dates)
1170
- if cllmm_type == 'd':
1171
- E, D = coorong_level_calc(EWR_info, df_5_day_averages['mean'], water_years, df_L.index, masked_dates)
1157
+ all_required_gauges_in_df_L = [gauge for gauge in all_required_gauges if gauge in df_L.columns]
1158
+ #NOTE as all_required_gauges_in_df_L is boolean, the indexing is stil including all gauges in all_required_gauges.
1159
+ # directly subset and use all_required_gauges_in_df_L as the new list.
1160
+ if all_required_gauges_in_df_L:
1161
+ pull = data_inputs.get_EWR_components('barrage-level')
1162
+ EWR_info = get_EWRs(PU, gauge, EWR, EWR_table, pull)
1163
+ masked_dates = mask_dates(EWR_info, df_L)
1164
+ # Extract a daily timeseries for water years:
1165
+ water_years = wateryear_daily(df_L, EWR_info)
1166
+ # If there is no level data loaded in, let user know and skip the analysis
1167
+ df = df_L.copy(deep=True)
1168
+ # calculate 5 day moving average and average of all required gauges
1169
+ df_5_day_averages = calculate_n_day_moving_average(df,5)
1170
+ df_5_day_averages['mean'] = df[all_required_gauges_in_df_L].mean(axis=1)
1171
+ cllmm_type = what_cllmm_type(EWR_info)
1172
+ if cllmm_type == 'c':
1173
+ E, D = lower_lakes_level_calc(EWR_info, df_5_day_averages['mean'], water_years, df_L.index, masked_dates)
1174
+ if cllmm_type == 'd':
1175
+ E, D = coorong_level_calc(EWR_info, df_5_day_averages['mean'], water_years, df_L.index, masked_dates)
1172
1176
 
1173
1177
  PU_df = event_stats(df_L, PU_df, gauge, EWR, EWR_info, E, D, water_years)
1174
1178
  return PU_df, tuple([E])
1175
1179
 
1176
1180
  else:
1177
- print(f'skipping calculation because gauge {" ".join(all_required_gauges)} is not the main barrage level gauge ')
1181
+ print(f'skipping calculation because gauge {" ".join(all_required_gauges)} is not the main barrage level gauge ') #TODO: improve error message
1178
1182
  return PU_df, None
1179
1183
 
1180
1184
  def rise_and_fall_handle(PU: str, gauge: str, EWR: str, EWR_table: pd.DataFrame, df_F: pd.DataFrame, df_L: pd.DataFrame, PU_df: pd.DataFrame) -> tuple:
@@ -1347,6 +1347,7 @@ LOCK7US,River Murray U/S Lock 7,,426508,5
1347
1347
  LOCK7US,River Murray U/S Lock 7,,A4260508,5
1348
1348
  LOCK8DS,River Murray D/S Lock 8,,4260507,5
1349
1349
  LOCK8US,River Murray U/S Lock 8,,426506,5
1350
+ LOCK8US,River Murray U/S Lock 8,,A426506,5
1350
1351
  LOCK9DS,River Murray D/S Lock 9,,4260505,5
1351
1352
  LOCK 9 ,River Murray U/S Lock 9,SAMPLE AT GAUGING STATION,A4260501,5
1352
1353
  LOCK9US,River Murray U/S Lock 9,SAMPLE AT GAUGING STATION,A4260501,5
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: py_ewr
3
- Version: 2.3.1
3
+ Version: 2.3.2
4
4
  Summary: Environmental Water Requirement calculator
5
5
  Home-page: https://github.com/MDBAuth/EWR_tool
6
6
  Author: Martin Job
@@ -34,9 +34,10 @@ Requires-Dist: numpy<2
34
34
  [![PyPI](https://img.shields.io/pypi/v/py-ewr)](https://pypi.org/project/py-ewr/)
35
35
  [![DOI](https://zenodo.org/badge/342122359.svg)](https://zenodo.org/badge/latestdoi/342122359)
36
36
 
37
- ### **EWR tool version 2.3.1 README**
37
+ ### **EWR tool version 2.3.2 README**
38
38
 
39
39
  ### **Notes on recent version updates**
40
+ - CLLMM_c and CLLMM_d ewrs are now able to be calculated without all barrage level gauges being present in the model file.
40
41
  - Including draft objective mapping files in the package (see below sub heading **Objective mapping** for more information). Objective mapping has been therefore pulled out of the parameter sheet
41
42
  - Including an example parallel processing script for running the EWR tool
42
43
  - Adding handling for cases where there are single MDBA bigmod site IDs mapping to multiple different gauges
@@ -1,11 +1,11 @@
1
1
  py_ewr/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  py_ewr/data_inputs.py,sha256=oUiEiLY_CmbvqF5GlV-3Yfz_JZ1qZNvta-VEYCzAcso,20124
3
- py_ewr/evaluate_EWRs.py,sha256=bAhFZTQZkoAE2eKgNIomm1LJdZ2HihoygUnXybtEdm4,231326
3
+ py_ewr/evaluate_EWRs.py,sha256=KESFs1boNuq2FPPgoZY_fqWpENFI39taPyv-0ePAD3s,231607
4
4
  py_ewr/io.py,sha256=Is0xPAzLx6-ylpTFyYJxMimkNVxxoTxUcknTk6bQbgs,840
5
5
  py_ewr/observed_handling.py,sha256=JTSK_2obhqNWJ2QknykywevNMN0fsvGXSejFwUSpMoA,18112
6
6
  py_ewr/scenario_handling.py,sha256=veaiQ6vfQX40laUk3eEUFWqO3wceP76Wh92HhJFsl8A,35762
7
7
  py_ewr/summarise_results.py,sha256=rFaAUVR4jIsjeRl4ocPFE2RUoJJBZgZ2wPEBh-dfEsc,31761
8
- py_ewr/model_metadata/SiteID_MDBA.csv,sha256=QDIW21IFX1MYxDvs6Aja-OOUBhgnNa8l-NnCpQMmBl4,168430
8
+ py_ewr/model_metadata/SiteID_MDBA.csv,sha256=X5bFFYRkmQWqV05tWtij9OphwlonzxcpzYebTz4waqI,168474
9
9
  py_ewr/model_metadata/SiteID_NSW.csv,sha256=UVBxN43Z5KWCvWhQ5Rh6TNEn35q4_sjPxKyHg8wPFws,6805
10
10
  py_ewr/model_metadata/iqqm_stations.csv,sha256=vl4CPtPslG5VplSzf_yLZulTrmab-mEBHOfzFtS1kf4,110
11
11
  py_ewr/parameter_metadata/ewr2obj.csv,sha256=r2uXzhZ-Rd1u3RLhNXmJnPYcHwouHBehEPnvednfz-I,3948677
@@ -13,8 +13,8 @@ py_ewr/parameter_metadata/ewr_calc_config.json,sha256=l1AgIRlf7UUmk3BNQ4r3kutU48
13
13
  py_ewr/parameter_metadata/obj2target.csv,sha256=f6kLVyBhXUpGR4b0dzLbBvZbfpn3OxOhaB4aouO6Bvw,1593877
14
14
  py_ewr/parameter_metadata/obj2yrtarget.csv,sha256=G8XgdCrOpB0xhp6n7DIS4Vcq69Kpgb1Pum7Ay3a_YPU,54882
15
15
  py_ewr/parameter_metadata/parameter_sheet.csv,sha256=MxKE-649bIC6HGqh87MT_fR3Lmew8n10Oi6OsAF1N0Q,768524
16
- py_ewr-2.3.1.dist-info/LICENSE,sha256=ogEPNDSH0_dhiv_lT3ifVIdgIzHAqNA_SemnxUfPBJk,7048
17
- py_ewr-2.3.1.dist-info/METADATA,sha256=QAW_W9RLEq6SXwpl68WRObU7cEUq_MCpygk8cDkAFtQ,12585
18
- py_ewr-2.3.1.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
19
- py_ewr-2.3.1.dist-info/top_level.txt,sha256=n3725d-64Cjyb-YMUMV64UAuIflzUh2_UZSxiIbrur4,7
20
- py_ewr-2.3.1.dist-info/RECORD,,
16
+ py_ewr-2.3.2.dist-info/LICENSE,sha256=ogEPNDSH0_dhiv_lT3ifVIdgIzHAqNA_SemnxUfPBJk,7048
17
+ py_ewr-2.3.2.dist-info/METADATA,sha256=7SxKbPMv5Ue-p95_mUws2xSs11TrHAOzfDAIeXi3CIE,12709
18
+ py_ewr-2.3.2.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
19
+ py_ewr-2.3.2.dist-info/top_level.txt,sha256=n3725d-64Cjyb-YMUMV64UAuIflzUh2_UZSxiIbrur4,7
20
+ py_ewr-2.3.2.dist-info/RECORD,,
File without changes