Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(parsers): Fix to include new Adani import column in BD data #7154

Merged
merged 6 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions parsers/ERP_PGCB.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"Wind",
"Bheramara HVDC",
"Tripura",
"Adani",
"Remarks",
]
PARSER = "ERP_PGCB.py"
Expand Down Expand Up @@ -99,7 +100,8 @@ def parse_table_body(table_body: Tag) -> list[dict]:
"wind": table_entry_to_float(row_items[10]),
"bd_import_bheramara": table_entry_to_float(row_items[11]),
"bd_import_tripura": table_entry_to_float(row_items[12]),
"remarks": row_items[13],
"bd_import_adani": table_entry_to_float(row_items[13]),
"remarks": row_items[14],
}
)

Expand Down Expand Up @@ -197,13 +199,12 @@ def fetch_production(
session = session or Session()

row_data = query(session, target_datetime, logger)

production_data_list = ProductionBreakdownList(logger)
for row in row_data:
# Create data with empty production
production = ProductionMix()

# And add sources if they are present in the table
# And add sources if they are present in the table z
known_sources_sum_mw = 0.0
for source_type in ["coal", "gas", "hydro", "oil", "solar", "wind"]:
if row[source_type] is not None:
Expand All @@ -214,12 +215,18 @@ def fetch_production(
# infer 'unknown'
if row["total_generation"] is not None:
# Total generation includes all sources, including imports so we need to subtract them to get the unknown source
# Before this date Adani import in NoneType

unknown_source_mw = (
row["total_generation"]
- known_sources_sum_mw
- row["bd_import_bheramara"]
- row["bd_import_tripura"]
)
# Adani import was added after this date
if target_datetime is None or target_datetime > datetime(2024, 8, 27):
unknown_source_mw -= row["bd_import_adani"]

production.add_value(
"unknown", unknown_source_mw, correct_negative_with_zero=True
)
Expand Down Expand Up @@ -291,8 +298,12 @@ def fetch_exchange(
# Export to India NorthEast via Tripura
bd_import = row["bd_import_tripura"]
elif zone_key2 == "IN-EA":
# Export to India East via Bheramara
# Export to India East via Bheramara and Adani (Jharkhand plant)
bd_import = row["bd_import_bheramara"]

if target_datetime is None or target_datetime > datetime(2024, 8, 27):
bd_import += row["bd_import_adani"]

else:
raise ParserException(
parser=PARSER,
Expand Down
Loading
Loading