Skip to content

Commit

Permalink
fix missing BA codes pre 2013
Browse files Browse the repository at this point in the history
  • Loading branch information
grgmiller committed May 24, 2024
1 parent b26bf17 commit 5bcaf23
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/oge/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,18 @@ def create_plant_ba_table(year: int) -> pd.DataFrame:
],
)

# for some earlier years, the plants data is missing BA codes.
# backfill and forwardfill to make sure that we have complete data for all years, if
# data is available for any year
for col in [
"balancing_authority_code_eia",
"utility_id_eia",
"balancing_authority_name_eia",
"transmission_distribution_owner_name",
]:
plant_ba[col] = plant_ba.groupby(["plant_id_eia"])[col].bfill()
plant_ba[col] = plant_ba.groupby(["plant_id_eia"])[col].ffill()

# remove report dates newer than the current year
plant_ba = plant_ba[plant_ba["report_date"].dt.year <= year]

Expand Down

0 comments on commit 5bcaf23

Please sign in to comment.