py-ewr 2.3.4__py3-none-any.whl → 2.3.6__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
@@ -837,6 +837,7 @@ def weirpool_handle(PU: str, gauge: str, EWR: str, EWR_table: pd.DataFrame, df_F
837
837
  tuple[pd.DataFrame, tuple[dict]]: EWR results for the current planning unit iteration (updated); dictionary of EWR event information
838
838
 
839
839
  '''
840
+
840
841
  # Get information about EWR (changes depending on the weirpool type):
841
842
  weirpool_type = data_inputs.weirpool_type(EWR)
842
843
  if weirpool_type == 'raising':
@@ -851,6 +852,7 @@ def weirpool_handle(PU: str, gauge: str, EWR: str, EWR_table: pd.DataFrame, df_F
851
852
  # If there is no level data loaded in, let user know and skip the analysis
852
853
  try:
853
854
  levels = df_L[EWR_info['weirpool_gauge']].values
855
+
854
856
  except KeyError:
855
857
  print(f'''Cannot evaluate this ewr for {gauge} {EWR}, due to missing data. Specifically this EWR
856
858
  also needs data for level gauge {EWR_info.get('weirpool_gauge', 'no wp gauge')}''')
@@ -4965,8 +4967,8 @@ def merge_weirpool_with_freshes(wp_freshes:List, PU_df:pd.DataFrame)-> pd.DataFr
4965
4967
  pd.DataFrame: Return Dataframe with the statistics of the merged EWR
4966
4968
  """
4967
4969
 
4968
- weirpool_pair = {'SF_WP':'WP3',
4969
- 'LF2_WP': 'WP4' }
4970
+ weirpool_pair = {'SF-WP':'WP3',
4971
+ 'LF2-WP': 'WP4' }
4970
4972
 
4971
4973
  for fresh in wp_freshes:
4972
4974
  try:
@@ -5006,7 +5008,7 @@ def merge_weirpool_with_freshes(wp_freshes:List, PU_df:pd.DataFrame)-> pd.DataFr
5006
5008
  column_attributes = list(set([col.split("_")[-1] for col in PU_df.columns if "eventYears" not in col]))
5007
5009
  for col in column_attributes:
5008
5010
  PU_df[f"{fresh}/{weirpool_pair[fresh]}_{col}"] = np.nan
5009
-
5011
+
5010
5012
  return PU_df
5011
5013
 
5012
5014
  # make handling function available to process
@@ -5133,6 +5135,7 @@ def calc_sorter(df_F:pd.DataFrame, df_L:pd.DataFrame, gauge:str, EWR_table:pd.Da
5133
5135
  EWR_codes = PU_table['Code']
5134
5136
  PU_df = pd.DataFrame()
5135
5137
  PU_events = {}
5138
+
5136
5139
  for i, EWR in enumerate(EWR_codes):
5137
5140
  events = {}
5138
5141
 
@@ -5165,10 +5168,10 @@ def calc_sorter(df_F:pd.DataFrame, df_L:pd.DataFrame, gauge:str, EWR_table:pd.Da
5165
5168
  PU_df, events = handle_function(**kwargs)
5166
5169
  if events != {}:
5167
5170
  PU_events[str(EWR)]=events
5168
-
5169
- wp_freshes = [ewr for ewr in EWR_codes if ewr in ["SF_WP","LF2_WP"]]
5170
- if wp_freshes:
5171
- PU_df = merge_weirpool_with_freshes(wp_freshes, PU_df)
5171
+
5172
+ # wp_freshes = [ewr for ewr in EWR_codes.to_list() if ewr in ["SF-WP","LF2-WP"]]
5173
+ # if wp_freshes:
5174
+ # PU_df = merge_weirpool_with_freshes(wp_freshes, PU_df)
5172
5175
 
5173
5176
  PU_name = PU_items['PlanningUnitName'].loc[PU_items[PU_items['PlanningUnitID'] == PU].index[0]]
5174
5177