Skip to content

Commit

Permalink
fix for AEMO changing the name a tab in NEM Registration and Exemptio…
Browse files Browse the repository at this point in the history
…n List.xls
  • Loading branch information
nick-gorman committed Jun 25, 2024
1 parent 9ed5346 commit 353ec09
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 12 deletions.
9 changes: 8 additions & 1 deletion nemosis/data_fetch_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,14 @@ def _read_static_csv(path_and_name, table_name):

def _read_excel(path_and_name, table_name):
xls = _pd.ExcelFile(path_and_name)
return _pd.read_excel(xls, _defaults.reg_exemption_list_tabs[table_name], dtype=str)
for tab_option in _defaults.reg_exemption_list_tabs[table_name]:
try:
return _pd.read_excel(xls, tab_option, dtype=str)
except ValueError as e:
pass
raise NoDataToReturn(f"""
The excel file did not have any of the expected tabs {_defaults.reg_exemption_list_tabs[table_name]}.
""")


def _finalise_excel_data(data, table_name):
Expand Down
4 changes: 2 additions & 2 deletions nemosis/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -849,8 +849,8 @@
}

reg_exemption_list_tabs = {
"Generators and Scheduled Loads": "Generators and Scheduled Loads",
"FCAS Providers": "Ancillary Services",
"Generators and Scheduled Loads": ["Generators and Scheduled Loads", "PU and Scheduled Loads"],
"FCAS Providers": ["Ancillary Services"],
}

months = ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"]
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="nemosis",
version="3.5.0",
version="3.7.0",
author="Nicholas Gorman, Abhijith Prakash",
author_email="n.gorman305@gmail.com",
description="A tool for accessing AEMO data.",
Expand Down
16 changes: 8 additions & 8 deletions tests/test_data_fetch_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -838,8 +838,8 @@ def setUp(self):
}

def test_dispatch_tables_start_of_month(self):
start_time = "2024/04/01 00:00:00"
end_time = "2024/04/01 05:15:00"
start_time = "2024/06/01 00:00:00"
end_time = "2024/06/01 05:15:00"
for table in self.table_names:
print(f"Testing {table} returning values at start of month one.")
dat_col = defaults.primary_date_columns[table]
Expand Down Expand Up @@ -867,8 +867,8 @@ def test_dispatch_tables_start_of_month(self):
print("Passed")

def test_dispatch_tables_middle_of_month_and_day(self):
start_time = "2024/04/05 12:00:00"
end_time = "2024/04/05 17:15:00"
start_time = "2024/06/05 12:00:00"
end_time = "2024/06/05 17:15:00"
for table in self.table_names:
print(f"Testing {table} returning values at start of month one.")
dat_col = defaults.primary_date_columns[table]
Expand Down Expand Up @@ -896,8 +896,8 @@ def test_dispatch_tables_middle_of_month_and_day(self):
print("Passed")

def test_dispatch_tables_start_market_day(self):
start_time = "2024/04/05 04:00:00"
end_time = "2024/04/05 04:05:00"
start_time = "2024/06/05 04:00:00"
end_time = "2024/06/05 04:05:00"
for table in self.table_names:
print(f"Testing {table} returning values at start of month one.")
dat_col = defaults.primary_date_columns[table]
Expand Down Expand Up @@ -925,8 +925,8 @@ def test_dispatch_tables_start_market_day(self):
print("Passed")

def test_dispatch_tables_end_market_day(self):
start_time = "2024/04/05 03:55:00"
end_time = "2024/04/05 04:00:00"
start_time = "2024/06/05 03:55:00"
end_time = "2024/06/05 04:00:00"
for table in self.table_names:
print(f"Testing {table} returning values at start of month one.")
dat_col = defaults.primary_date_columns[table]
Expand Down

0 comments on commit 353ec09

Please sign in to comment.