Skip to content

Commit

Permalink
refactor: use BA as primary interconnect mapper, NERC region as fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
danielolsen committed Feb 18, 2022
1 parent 65bcb5b commit 98d272b
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions prereise/gather/griddata/hifld/data_process/generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,16 +374,17 @@ def build_plant(bus, substations, kwargs={}):
substations = substations.loc[set(bus_groupby.groups.keys())]
epa_ampd_groupby = epa_ampd.groupby(["ORISPL_CODE", "UNITID"])

# Add information
# Add information to generators based on Form 860 Plant table
generators = generators.merge(plants, on="Plant Code", suffixes=(None, "_860Plant"))
generators.rename(
{"Latitude": "lat", "Longitude": "lon", "Zip": "ZIP"}, axis=1, inplace=True
)
# Map interconnect via BA first (more reliable) then by NERC Region
generators["interconnect"] = (
generators["Plant Code"]
.map(plants["NERC Region"])
.map(const.nercregion2interconnect)
generators["Balancing Authority Code"]
.map(const.balancingauthority2interconnect)
.combine_first(generators["NERC Region"].map(const.nercregion2interconnect))
)
generators["lat"] = generators["Plant Code"].map(plants["Latitude"])
generators["lon"] = generators["Plant Code"].map(plants["Longitude"])
generators["ZIP"] = generators["Plant Code"].map(plants["Zip"])
generators["state"] = generators["Plant Code"].map(plants["State"])

# Ensure we have Pmax and Pmin for each generator
generators["Pmax"] = generators[
Expand Down

0 comments on commit 98d272b

Please sign in to comment.