py-ewr 2.3.6__py3-none-any.whl → 2.3.8__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.
@@ -44,7 +44,7 @@ def get_ewr_columns(ewr:str, cols:List) -> List:
44
44
 
45
45
 
46
46
  def get_columns_attributes(cols: List)-> List:
47
- """Takes a list of columns with the pattern EwrCode_Attribute
47
+ """Takes a list of columns with the pattern Code_Attribute
48
48
  and relates them returning only the Attribute name.
49
49
 
50
50
  Args:
@@ -74,8 +74,8 @@ def pu_dfs_to_process(detailed_results: Dict)-> List[Dict]:
74
74
  either observed or scenario and unpack items into a list of items.
75
75
  Each item is a dictionary with the following keys.
76
76
  { "scenario" : scenario_name,
77
- "gauge" : gauge_id,
78
- "pu" : pu_name,
77
+ 'Gauge' : gauge_id,
78
+ "PlanningUnit" : pu_name,
79
79
  "pu_df : DataFrame}
80
80
 
81
81
  Args:
@@ -85,7 +85,7 @@ def pu_dfs_to_process(detailed_results: Dict)-> List[Dict]:
85
85
  }
86
86
 
87
87
  }
88
- It packs in a dictionary all the gauge ewr calculation for the scenario
88
+ It packs in a dictionary all the gauge Code calculation for the scenario
89
89
  or observed dates run.
90
90
 
91
91
  Returns:
@@ -97,7 +97,7 @@ def pu_dfs_to_process(detailed_results: Dict)-> List[Dict]:
97
97
  for pu in detailed_results[scenario][gauge]:
98
98
  item = {}
99
99
  item["scenario"] = scenario
100
- item["gauge"] = gauge
100
+ item['gauge'] = gauge
101
101
  item["pu"] = pu
102
102
  item["pu_df"] = detailed_results[scenario][gauge][pu]
103
103
  items_to_process.append(item)
@@ -109,8 +109,8 @@ def process_df(scenario:str, gauge:str, pu:str, pu_df: pd.DataFrame)-> pd.DataFr
109
109
 
110
110
  Args:
111
111
  scenario (str): scenario name metadata
112
- gauge (str): gauge name metadata
113
- pu (str): planning unit name metadata
112
+ Gauge (str): gauge name metadata
113
+ PlanningUnit (str): planning unit name metadata
114
114
  pu_df (pd.DataFrame): DataFrame to be transformed
115
115
 
116
116
  Returns:
@@ -124,10 +124,10 @@ def process_df(scenario:str, gauge:str, pu:str, pu_df: pd.DataFrame)-> pd.DataFr
124
124
  column_attributes = get_columns_attributes(ewr_df.columns.to_list())
125
125
  ewr_df.columns = column_attributes
126
126
  ewr_df = ewr_df.reset_index().rename(columns={"index":'Year'})
127
- ewr_df["ewrCode"] = ewr
127
+ ewr_df["Code"] = ewr
128
128
  ewr_df["scenario"] = scenario
129
- ewr_df["gauge"] = gauge
130
- ewr_df["pu"] = pu
129
+ ewr_df['Gauge'] = gauge
130
+ ewr_df["PlanningUnit"] = pu
131
131
  ewr_df = ewr_df.loc[:,~ewr_df.columns.duplicated()]
132
132
  returned_dfs.append(ewr_df)
133
133
  return pd.concat(returned_dfs, ignore_index=True)
@@ -157,9 +157,9 @@ def get_events_to_process(gauge_events: dict)-> List:
157
157
  and unpack items into a list of items.
158
158
  Each item is a dictionary with the following keys.
159
159
  { "scenario" : scenario_name,
160
- "gauge" : gauge_id,
161
- "pu" : pu_name,
162
- "ewr": ewr_code
160
+ 'Gauge' : gauge_id,
161
+ "PlanningUnit" : pu_name,
162
+ "Code": Code
163
163
  "ewr_events" : yearly_events_dictionary}
164
164
 
165
165
  Args:
@@ -190,7 +190,7 @@ def get_events_to_process(gauge_events: dict)-> List:
190
190
  try:
191
191
  item = {}
192
192
  item["scenario"] = scenario
193
- item["gauge"] = gauge
193
+ item['gauge'] = gauge
194
194
  item["pu"] = pu
195
195
  item["ewr"] = ewr
196
196
  item["ewr_events"], = gauge_events[scenario][gauge][pu][ewr]
@@ -206,7 +206,6 @@ def count_events(yearly_events:dict)-> int:
206
206
 
207
207
  Args:
208
208
  yearly_events (dict): ewr yearly events dictionary of lists of lists
209
-
210
209
  Returns:
211
210
  int: count of length of all events in the collection of years
212
211
  """
@@ -233,8 +232,8 @@ def process_yearly_events(scenario:str, gauge:str, pu:str, ewr:str, ewr_events:
233
232
  Args:
234
233
  scenario (str): scenario name metadata
235
234
  gauge (str): gauge name metadata
236
- pu (str): planning unit name metadata
237
- ewr (str): DataFrame to be transformed
235
+ PlanningUnit (str): planning unit name metadata
236
+ Code (str): DataFrame to be transformed
238
237
  ewr_events (Dict): Dict with all yearly events list with date and flow/level
239
238
 
240
239
  Returns:
@@ -246,9 +245,9 @@ def process_yearly_events(scenario:str, gauge:str, pu:str, ewr:str, ewr_events:
246
245
  total_event_days = sum_events(yearly_events)
247
246
  average_event_length = total_event_days/total_events if total_events else 0
248
247
  row_data['scenario'].append(scenario)
249
- row_data['gauge'].append(gauge)
250
- row_data['pu'].append(pu)
251
- row_data['ewrCode'].append(ewr)
248
+ row_data['Gauge'].append(gauge)
249
+ row_data['PlanningUnit'].append(pu)
250
+ row_data['Code'].append(ewr)
252
251
  row_data['totalEvents'].append(total_events)
253
252
  row_data['totalEventDays'].append(total_event_days)
254
253
  row_data['averageEventLength'].append(average_event_length)
@@ -278,13 +277,13 @@ def process_all_yearly_events(scenario:str, gauge:str, pu:str, ewr:str, ewr_even
278
277
  Args:
279
278
  scenario (str): scenario name metadata
280
279
  gauge (str): gauge name metadata
281
- pu (str): planning unit name metadata
282
- ewr (str): DataFrame to be transformed
280
+ PlanningUnit (str): planning unit name metadata
281
+ Code (str): DataFrame to be transformed
283
282
  ewr_events (Dict): Dict with all yearly events list with date and flow/level
284
283
 
285
284
 
286
285
  Returns:
287
- pd.DataFrame: DataFrame with all events of Pu-ewr-gauge combination
286
+ pd.DataFrame: DataFrame with all events of Pu-Code-gauge combination
288
287
  """
289
288
  df_data = defaultdict(list)
290
289
  for year in ewr_events:
@@ -292,9 +291,9 @@ def process_all_yearly_events(scenario:str, gauge:str, pu:str, ewr:str, ewr_even
292
291
  start_date, _ = ev[0]
293
292
  end_date, _ = ev[-1]
294
293
  df_data["scenario"].append(scenario)
295
- df_data["gauge"].append(gauge)
296
- df_data["pu"].append(pu)
297
- df_data["ewr"].append(ewr)
294
+ df_data['Gauge'].append(gauge)
295
+ df_data["PlanningUnit"].append(pu)
296
+ df_data["Code"].append(ewr)
298
297
  df_data["waterYear"].append(year)
299
298
  df_data["startDate"].append(start_date )
300
299
  df_data["endDate"].append(end_date)
@@ -372,7 +371,7 @@ def sum_0(series:pd.Series) -> int:
372
371
 
373
372
  def summarise(input_dict:Dict , events:Dict, parameter_sheet_path:str = None)-> pd.DataFrame:
374
373
  """orchestrate the processing of the pu_dfs items and the gauge events and join
375
- in one summary DataFrame and join with EWR parameters for comparison
374
+ in one summary DataFrame and join with ewr parameters for comparison
376
375
 
377
376
  Args:
378
377
  input_dict (Dict): DataFrame result by yearly with statistics for the ewr calculations.
@@ -384,21 +383,21 @@ def summarise(input_dict:Dict , events:Dict, parameter_sheet_path:str = None)->
384
383
  to_process = pu_dfs_to_process(input_dict)
385
384
  yearly_ewr_results = process_df_results(to_process)
386
385
 
387
- # aggregate by "gauge","pu","ewrCode"
386
+ # aggregate by 'Gauge',"PlanningUnit","Code"
388
387
  final_summary_output = (yearly_ewr_results
389
- .groupby(["scenario","gauge","pu","ewrCode"])
390
- .agg( EventYears = ("eventYears", sum),
388
+ .groupby(["scenario",'Gauge',"PlanningUnit","Code"])
389
+ .agg( EventYears = ("eventYears", 'sum'),
391
390
  Frequency = ("eventYears", get_frequency),
392
- AchievementCount = ("numAchieved", sum),
391
+ AchievementCount = ("numAchieved", 'sum'),
393
392
  AchievementPerYear = ("numAchieved", 'mean'),
394
- EventCount = ("numEvents",sum),
395
- EventCountAll = ("numEventsAll",sum),
393
+ EventCount = ("numEvents",'sum'),
394
+ EventCountAll = ("numEventsAll",'sum'),
396
395
  EventsPerYear = ("numEvents",'mean'),
397
396
  EventsPerYearAll = ("numEventsAll",'mean'),
398
- ThresholdDays = ("totalEventDays", sum),
397
+ ThresholdDays = ("totalEventDays", 'sum'),
399
398
  # InterEventExceedingCount = ("rollingMaxInterEventAchieved", sum_0),#"maxInterEventDaysAchieved"
400
- NoDataDays = ("missingDays" , sum),
401
- TotalDays = ("totalPossibleDays" , sum),
399
+ NoDataDays = ("missingDays" , 'sum'),
400
+ TotalDays = ("totalPossibleDays" , 'sum'),
402
401
  )
403
402
  )
404
403
  # summarize gauge events
@@ -410,16 +409,16 @@ def summarise(input_dict:Dict , events:Dict, parameter_sheet_path:str = None)->
410
409
 
411
410
  final_summary_output = final_summary_output.merge(ewr_event_stats,
412
411
  'left',
413
- left_on=['scenario', 'gauge','pu','ewrCode'],
414
- right_on=['scenario', 'gauge','pu',"ewrCode"])
412
+ left_on=['scenario', 'Gauge','PlanningUnit','Code'],
413
+ right_on=['scenario', 'Gauge','PlanningUnit',"Code"])
415
414
  # Join Ewr parameter to summary
416
415
 
417
416
  final_merged = join_ewr_parameters(cols_to_add=['TargetFrequency','MaxInter-event','Multigauge', 'State', 'SWSDLName'],
418
417
  left_table=final_summary_output,
419
- left_on=['gauge','pu','ewrCode'],
420
- selected_columns=["scenario",'gauge',
421
- 'pu', 'State', 'SWSDLName',
422
- 'ewrCode',
418
+ left_on=['Gauge','PlanningUnit','Code'],
419
+ selected_columns=["scenario",'Gauge',
420
+ 'PlanningUnit', 'State', 'SWSDLName',
421
+ 'Code',
423
422
  'Multigauge',
424
423
  'EventYears',
425
424
  'Frequency',
@@ -436,7 +435,7 @@ def summarise(input_dict:Dict , events:Dict, parameter_sheet_path:str = None)->
436
435
  'MaxInter-event',
437
436
  'NoDataDays',
438
437
  'TotalDays'],
439
- renamed_columns=['Scenario','Gauge', 'PlanningUnit', 'State', 'SWSDLName', 'EwrCode', 'Multigauge','EventYears', 'Frequency', 'TargetFrequency',
438
+ renamed_columns=['Scenario','Gauge', 'PlanningUnit', 'State', 'SWSDLName', 'Code', 'Multigauge','EventYears', 'Frequency', 'TargetFrequency',
440
439
  'AchievementCount', 'AchievementPerYear', 'EventCount', 'EventCountAll','EventsPerYear', 'EventsPerYearAll',
441
440
  'AverageEventLength', 'ThresholdDays', #'InterEventExceedingCount',
442
441
  'MaxInterEventYears', 'NoDataDays', 'TotalDays'],
@@ -459,7 +458,7 @@ def filter_duplicate_start_dates(df: pd.DataFrame) -> pd.DataFrame:
459
458
 
460
459
  '''
461
460
 
462
- df.drop_duplicates(subset = ['scenario', 'gauge', 'pu', 'ewr', 'startDate'], keep='last', inplace=True)
461
+ df.drop_duplicates(subset = ['scenario', 'Gauge', 'PlanningUnit', 'Code', 'startDate'], keep='last', inplace=True)
463
462
 
464
463
  return df
465
464
 
@@ -505,9 +504,9 @@ def events_to_interevents(start_date: date, end_date: date, df_events: pd.DataFr
505
504
 
506
505
  '''
507
506
  # Create the unique ID field
508
- df_events['ID'] = df_events['scenario']+df_events['gauge']+df_events['pu']+df_events['ewr']
507
+ df_events['ID'] = df_events['scenario']+df_events['Gauge']+df_events['PlanningUnit']+df_events['Code']
509
508
  unique_ID = df_events['ID'].unique()
510
- all_interEvents = pd.DataFrame(columns = ['scenario', 'gauge', 'pu', 'State', 'SWSDLName', 'ewr', 'ID',
509
+ all_interEvents = pd.DataFrame(columns = ['scenario', 'Gauge', 'PlanningUnit', 'State', 'SWSDLName', 'Code', 'ID',
511
510
  'startDate', 'endDate', 'interEventLength'])
512
511
 
513
512
  for i in unique_ID:
@@ -528,14 +527,14 @@ def events_to_interevents(start_date: date, end_date: date, df_events: pd.DataFr
528
527
  if length > 0:
529
528
  # Create the new dataframe:
530
529
  new_scenario = [contain_values['scenario'].iloc[0]]*length
531
- new_gauge = [contain_values['gauge'].iloc[0]]*length
532
- new_pu = [contain_values['pu'].iloc[0]]*length
530
+ new_gauge = [contain_values['Gauge'].iloc[0]]*length
531
+ new_pu = [contain_values['PlanningUnit'].iloc[0]]*length
533
532
  new_state = [contain_values['State'].iloc[0]]*length
534
533
  new_sdl = [contain_values['SWSDLName'].iloc[0]]*length
535
- new_ewr = [contain_values['ewr'].iloc[0]]*length
534
+ new_ewr = [contain_values['Code'].iloc[0]]*length
536
535
  new_ID = [contain_values['ID'].iloc[0]]*length
537
536
 
538
- data = {'scenario': new_scenario, 'gauge': new_gauge, 'pu': new_pu, 'State': new_state, 'SWSDLName': new_sdl, 'ewr': new_ewr, 'ID': new_ID, 'startDate': inter_starts, 'endDate': inter_ends}
537
+ data = {'scenario': new_scenario, 'Gauge': new_gauge, 'PlanningUnit': new_pu, 'State': new_state, 'SWSDLName': new_sdl, 'Code': new_ewr, 'ID': new_ID, 'startDate': inter_starts, 'endDate': inter_ends}
539
538
 
540
539
  df_subset = pd.DataFrame(data=data)
541
540
 
@@ -559,7 +558,7 @@ def events_to_interevents(start_date: date, end_date: date, df_events: pd.DataFr
559
558
  # Remove 0 length entries (these can happen if there was an event on the first or last day of timeseries)
560
559
  df_subset = df_subset.drop(df_subset[df_subset.interEventLength == 0].index)
561
560
 
562
- # Add the EWR interevents onto the main dataframe:
561
+ # Add the ewr interevents onto the main dataframe:
563
562
  all_interEvents = pd.concat([all_interEvents, df_subset], ignore_index=True)
564
563
 
565
564
  # Remove the ID column before returning
@@ -582,10 +581,10 @@ def filter_successful_events(all_events: pd.DataFrame, ewr_table_path: str = Non
582
581
 
583
582
  s = 'TEMPORARY_ID_SPLIT'
584
583
 
585
- all_events['ID'] = all_events['scenario']+s+all_events['gauge']+s+all_events['pu']+s+all_events['ewr']
584
+ all_events['ID'] = all_events['scenario']+s+all_events['Gauge']+s+all_events['PlanningUnit']+s+all_events['Code']
586
585
  unique_ID = list(OrderedDict.fromkeys(all_events['ID']))
587
586
  EWR_table, bad_EWRs = data_inputs.get_EWR_table(ewr_table_path)
588
- all_successfulEvents = pd.DataFrame(columns = ['scenario', 'gauge', 'pu', 'ewr', 'waterYear', 'startDate', 'endDate', 'eventDuration', 'eventLength', 'multigauge' 'ID'])
587
+ all_successfulEvents = pd.DataFrame(columns = ['scenario', 'Gauge', 'PlanningUnit', 'Code', 'waterYear', 'startDate', 'endDate', 'eventDuration', 'eventLength', 'multigauge' 'ID'])
589
588
 
590
589
  # Filter out unsuccesful events
591
590
  # Iterate over the all_events dataframe
@@ -596,7 +595,7 @@ def filter_successful_events(all_events: pd.DataFrame, ewr_table_path: str = Non
596
595
  pu = i.split('TEMPORARY_ID_SPLIT')[2]
597
596
  ewr = i.split('TEMPORARY_ID_SPLIT')[3]
598
597
 
599
- # Pull EWR minSpell value from EWR dataset
598
+ # Pull ewr minSpell value from ewr dataset
600
599
  minSpell = int(data_inputs.ewr_parameter_grabber(EWR_table, gauge, pu, ewr, 'MinSpell'))
601
600
  # Filter out the events that fall under the minimum spell length
602
601
  df_subset = df_subset.drop(df_subset[df_subset.eventDuration < minSpell].index)
@@ -613,7 +612,7 @@ def get_rolling_max_interEvents(df:pd.DataFrame, start_date: date, end_date: dat
613
612
  start_date: Not used TODO: delete
614
613
  end_date: Not used TODO: delete
615
614
  yearly_df (pd.DataFrame): used to get list of all EWRs
616
- ewr_table_path: where to pull the EWR table from (local or custom)
615
+ ewr_table_path: where to pull the ewr table from (local or custom)
617
616
  Results:
618
617
  pd.DataFrame:
619
618
 
@@ -621,17 +620,17 @@ def get_rolling_max_interEvents(df:pd.DataFrame, start_date: date, end_date: dat
621
620
 
622
621
  s = 'TEMPORARY_ID_SPLIT'
623
622
 
624
- df['ID'] = df['scenario']+s+df['gauge']+s+df['pu']+s+df['ewr']
625
- yearly_df['ID'] = yearly_df['scenario']+s+yearly_df['gauge']+s+yearly_df['pu']+s+yearly_df['ewrCode']
623
+ df['ID'] = df['scenario']+s+df['Gauge']+s+df['PlanningUnit']+s+df['Code']
624
+ yearly_df['ID'] = yearly_df['scenario']+s+yearly_df['Gauge']+s+yearly_df['PlanningUnit']+s+yearly_df['Code']
626
625
  unique_ID = list(OrderedDict.fromkeys(yearly_df['ID']))
627
626
  master_dict = dict()
628
627
  unique_years = list(range(min(yearly_df['Year']),max(yearly_df['Year'])+1,1))
629
- # Load in EWR table to variable to access start and end dates of the EWR
628
+ # Load in ewr table to variable to access start and end dates of the ewr
630
629
  EWR_table, bad_EWRs = data_inputs.get_EWR_table(ewr_table_path)
631
630
  for unique_EWR in unique_ID:
632
631
  df_subset = df[df['ID'] == unique_EWR]
633
632
  yearly_df_subset = yearly_df[yearly_df['ID'] == unique_EWR]
634
- # Get EWR characteristics for current EWR
633
+ # Get ewr characteristics for current ewr
635
634
  scenario = unique_EWR.split('TEMPORARY_ID_SPLIT')[0]
636
635
  gauge = unique_EWR.split('TEMPORARY_ID_SPLIT')[1]
637
636
  pu = unique_EWR.split('TEMPORARY_ID_SPLIT')[2]
@@ -654,23 +653,12 @@ def get_rolling_max_interEvents(df:pd.DataFrame, start_date: date, end_date: dat
654
653
  master_dict[scenario][gauge][pu] = {}
655
654
  if ewr not in master_dict[scenario][gauge][pu]:
656
655
  master_dict[scenario][gauge][pu][ewr] = evaluate_EWRs.construct_event_dict(unique_years)
657
- # Pull EWR start and end date from EWR dataset and clean
656
+ # Pull ewr start and end date from ewr dataset and clean
658
657
  EWR_info = {}
659
- EWR_info['start_date'] = data_inputs.ewr_parameter_grabber(EWR_table, gauge, pu, ewr, 'StartMonth')
660
- EWR_info['end_date'] = data_inputs.ewr_parameter_grabber(EWR_table, gauge, pu, ewr, 'EndMonth')
661
- if '.' in EWR_info['start_date']:
662
- EWR_info['start_day'] = int(EWR_info['start_date'].split('.')[1])
663
- EWR_info['start_month'] = int(EWR_info['start_date'].split('.')[0])
664
- else:
665
- EWR_info['start_day'] = None
666
- EWR_info['start_month'] = int(EWR_info['start_date'])
667
-
668
- if '.' in EWR_info['end_date']:
669
- EWR_info['end_day'] = int(EWR_info['end_date'].split('.')[1])
670
- EWR_info['end_month'] = int(EWR_info['end_date'].split('.')[0])
671
- else:
672
- EWR_info['end_day'] = None
673
- EWR_info['end_month'] =int(EWR_info['end_date'])
658
+ EWR_info['start_month'] = evaluate_EWRs.component_pull(EWR_table, gauge, pu, ewr, 'StartMonth', pu_ID=False)
659
+ EWR_info['end_month'] = evaluate_EWRs.component_pull(EWR_table, gauge, pu, ewr, 'EndMonth', pu_ID=False)
660
+ EWR_info['start_day'] = evaluate_EWRs.component_pull(EWR_table, gauge, pu, ewr, 'StartDay', pu_ID=False)
661
+ EWR_info['end_day'] = evaluate_EWRs.component_pull(EWR_table, gauge, pu, ewr, 'EndDay', pu_ID=False)
674
662
 
675
663
  #--------------
676
664
  # for i, row in df_subset.iterrows():
@@ -683,7 +671,7 @@ def get_rolling_max_interEvents(df:pd.DataFrame, start_date: date, end_date: dat
683
671
  # current_date += timedelta(days=1)
684
672
 
685
673
  #--------------
686
- # Iterate over the interevent periods for this EWR
674
+ # Iterate over the interevent periods for this ewr
687
675
  for i, row in df_subset.iterrows():
688
676
  # Get the date range:
689
677
  period = pd.period_range(row['startDate'],row['endDate'])
@@ -709,20 +697,20 @@ def add_interevent_to_yearly_results(yearly_df: pd.DataFrame, yearly_dict:Dict)
709
697
 
710
698
  Args:
711
699
  yearly_df (pd.DataFrame): Yearly results dataframe summary
712
- yearly_dict (dict): Rolling maximum annual interevent period for every EWR
700
+ yearly_dict (dict): Rolling maximum annual interevent period for every ewr
713
701
  Returns:
714
702
  pd.DataFrame: Yearly results dataframe summary with the new column
715
703
  '''
716
704
  yearly_df['rollingMaxInterEvent'] = None
717
705
  # iterate yearly df, but ignore merged ewrs
718
- for i, row in yearly_df[~yearly_df['ewrCode'].str.contains('/', regex=False)].iterrows():
719
- ewr = yearly_df.loc[i, 'ewrCode']
706
+ for i, row in yearly_df[~yearly_df['Code'].str.contains('/', regex=False)].iterrows():
707
+ ewr = yearly_df.loc[i, 'Code']
720
708
  cllmm_post_processed = ["CLLMM2_e", "CLLMM3_e", "CLLMM4_e","CLLMM1_e","CLLMM1S_e"]
721
709
  if any( cllmm in ewr for cllmm in cllmm_post_processed):
722
710
  continue
723
711
  scenario = yearly_df.loc[i, 'scenario']
724
- gauge = yearly_df.loc[i, 'gauge']
725
- pu = yearly_df.loc[i, 'pu']
712
+ gauge = yearly_df.loc[i, 'Gauge']
713
+ pu = yearly_df.loc[i, 'PlanningUnit']
726
714
  year = yearly_df.loc[i, 'Year']
727
715
  value_to_add = yearly_dict[scenario][gauge][pu][ewr][year]
728
716
  yearly_df.loc[i, 'rollingMaxInterEvent'] = value_to_add
@@ -731,7 +719,7 @@ def add_interevent_to_yearly_results(yearly_df: pd.DataFrame, yearly_dict:Dict)
731
719
 
732
720
  def add_interevent_check_to_yearly_results(yearly_df: pd.DataFrame, ewr_table_path: str = None) -> pd.DataFrame:
733
721
  '''
734
- For each EWR, check to see if the rolling max interevent achieves the minimum requirement.
722
+ For each ewr, check to see if the rolling max interevent achieves the minimum requirement.
735
723
 
736
724
  Args:
737
725
  yearly_df (pd.DataFrame):
@@ -742,14 +730,14 @@ def add_interevent_check_to_yearly_results(yearly_df: pd.DataFrame, ewr_table_pa
742
730
 
743
731
  yearly_df['rollingMaxInterEventAchieved'] = None
744
732
 
745
- # Load in EWR table to variable to access start and end dates of the EWR
733
+ # Load in ewr table to variable to access start and end dates of the ewr
746
734
  EWR_table, bad_EWRs = data_inputs.get_EWR_table(ewr_table_path)
747
735
 
748
- # Get EWR characteristics for current EWR
736
+ # Get ewr characteristics for current ewr
749
737
  for i, row in yearly_df.iterrows():
750
- gauge = yearly_df.loc[i, 'gauge']
751
- pu = yearly_df.loc[i, 'pu']
752
- ewr = yearly_df.loc[i, 'ewrCode']
738
+ gauge = yearly_df.loc[i, 'Gauge']
739
+ pu = yearly_df.loc[i, 'PlanningUnit']
740
+ ewr = yearly_df.loc[i, 'Code']
753
741
 
754
742
  if '/' in ewr:
755
743
  yearly_df.loc[i, 'rollingMaxInterEventAchieved'] = None