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

feat: process plant data to create data frame #197

Merged
merged 5 commits into from
Sep 21, 2021
Merged

Conversation

danielolsen
Copy link
Contributor

@danielolsen danielolsen commented Jul 23, 2021

Pull Request doc

Purpose

Parse HIFLD data into the beginning of a plant data frame, for use with a Grid object.

What the code is doing

build_plant is the entry-point function, which will eventually return a data frame with all information, and all lower-level functions are accessed from this function. build_plant effectively replaces the old plant_agg function, with different structure. The lower level functions are:

  • map_generator_to_sub_by_location: look up substations within that interconnect and ZIP code, or if there are none, look within that interconnect and 'nearby' ZIP codes (+- 100). The logic of 'nearby' could probably be improved, but this is what was implemented in the collaborators' code.
  • map_generator_to_bus_by_sub: pick the lowest voltage bus within a specified substation.
  • add_locations_to_generators: use the locations from Power_Plants.csv, map them to the generating units as best as possible.
  • map_generators_to_interconnects: look up the county for each substation using the Power Plant mapping, then determine the interconnect.
  • add_pmin_to_generators: look up Pmin values from EIA Form 860.
  • helpers.map_state_and_county_to_interconnect: look up information from const.py to map a state/county to an interconnection. We also call this from data_process.transmission so that we can access this information for substations from within map_generator_to_sub_by_location.

There are also placeholders for:

  • estimate_heat_rate_from_ampd
  • add_heat_rate_to_generators

These will need further research into the best way to implement, but they are independent and so can wait for a follow-up PR.

Usage Example

>>> from prereise.gather.griddata.hifld.data_process.transmission import (
...     build_transmission,
...     create_buses,
... )
>>> from prereise.gather.griddata.hifld.data_process.generators import build_plant
>>> lines, substations = build_transmission()
>>> bus = create_buses(lines)
>>> plant = build_plant(bus, substations)
>>> plant.isna().sum()
ID                0
NAME              0
CITY              0
STATE             0
ZIP               0
TYPE              0
STATUS            0
COUNTRY           0
NAICS_CODE        0
NAICS_DESC        0
SOURCE            0
SOURCEDATE        0
PLANT             0
PLANT_CODE       86
OPERATOR          0
OPERAT_ID         0
NAMPLT_CAP        0
SUMMER_CAP        0
WINTER_CAP        0
PRIM_FUEL         0
FUEL1_TRAN        0
SEC_FUEL          0
FUEL2_TRAN        0
PRIM_MVR          0
RUN_DATE          0
RET_DATE          0
lat             402
lon             402
interconnect    402
sub_id          687
bus_id          687
Pmin              0
dtype: int64

Not all plant codes can be mapped successfully, and same with lats/lons, and therefore sub_id & bus_id, but we're only missing about 3%. Suggestions for improvement welcome.

Time to review

1 hour.

@danielolsen danielolsen changed the base branch from develop to hifld July 23, 2021 17:22
@danielolsen danielolsen force-pushed the daniel/hifld_plant branch 3 times, most recently from 51471c3 to d152077 Compare July 29, 2021 18:34
@danielolsen danielolsen force-pushed the daniel/hifld_plant branch 3 times, most recently from 9054db3 to 9f75dfe Compare August 11, 2021 22:02
@danielolsen danielolsen added the hifld Related to ingestion of the HIFLD data label Aug 24, 2021
@danielolsen danielolsen force-pushed the daniel/hifld_plant branch 3 times, most recently from 5e11dd1 to 7311ea9 Compare August 30, 2021 15:44
@danielolsen danielolsen self-assigned this Aug 30, 2021
@danielolsen danielolsen force-pushed the daniel/hifld_plant branch 3 times, most recently from 6e2d509 to f2d689b Compare September 1, 2021 21:28
@danielolsen danielolsen force-pushed the daniel/hifld_plant branch 4 times, most recently from 830de6a to 2cc6584 Compare September 10, 2021 14:21
@danielolsen danielolsen force-pushed the daniel/hifld_plant branch 4 times, most recently from d074b52 to 0db0882 Compare September 14, 2021 02:00
@danielolsen danielolsen marked this pull request as ready for review September 14, 2021 02:09
Copy link
Collaborator

@rouille rouille left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

@danielolsen danielolsen merged commit 9947097 into hifld Sep 21, 2021
@danielolsen danielolsen deleted the daniel/hifld_plant branch September 21, 2021 23:49
danielolsen added a commit that referenced this pull request Sep 22, 2021
feat: process plant data to create data frame
danielolsen added a commit that referenced this pull request Dec 8, 2021
feat: process plant data to create data frame
danielolsen added a commit that referenced this pull request Jan 5, 2022
feat: process plant data to create data frame
danielolsen added a commit that referenced this pull request Jan 8, 2022
feat: process plant data to create data frame
danielolsen added a commit that referenced this pull request Jan 31, 2022
feat: process plant data to create data frame
danielolsen added a commit that referenced this pull request Feb 25, 2022
feat: process plant data to create data frame
danielolsen added a commit that referenced this pull request Mar 15, 2022
feat: process plant data to create data frame
danielolsen added a commit that referenced this pull request Apr 1, 2022
feat: process plant data to create data frame
danielolsen added a commit that referenced this pull request Apr 5, 2022
feat: process plant data to create data frame
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hifld Related to ingestion of the HIFLD data
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants