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

add plant_id_pudl to small generators field #1293

Merged
merged 7 commits into from
Oct 22, 2021
11 changes: 6 additions & 5 deletions src/pudl/output/ferc1.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def plants_steam_ferc1(pudl_engine):
steam_df = (
pd.read_sql("plants_steam_ferc1", pudl_engine)
.merge(plants_utils_ferc1(pudl_engine),
on=['utility_id_ferc1', 'plant_name_ferc1'])
on=['utility_id_ferc1', 'plant_name_ferc1'], how='left')
.assign(
capacity_factor=lambda x:
x.net_generation_mwh / (8760 * x.capacity_mw),
Expand Down Expand Up @@ -148,12 +148,13 @@ def plants_small_ferc1(pudl_engine):
"""Pull a useful dataframe related to the FERC Form 1 small plants."""
plants_small_df = (
pd.read_sql_table("plants_small_ferc1", pudl_engine)
.merge(pd.read_sql_table("utilities_ferc1", pudl_engine),
on="utility_id_ferc1")
.merge(plants_utils_ferc1(pudl_engine),
on=["utility_id_ferc1", "plant_name_ferc1"], how='left')
.pipe(pudl.helpers.organize_cols, ['report_year',
'utility_id_ferc1',
'utility_id_pudl',
'utility_name_ferc1',
'plant_id_pudl',
'plant_name_ferc1',
"record_id"])
)
Expand All @@ -165,7 +166,7 @@ def plants_hydro_ferc1(pudl_engine):
plants_hydro_df = (
pd.read_sql_table("plants_hydro_ferc1", pudl_engine)
.merge(plants_utils_ferc1(pudl_engine),
on=["utility_id_ferc1", "plant_name_ferc1"])
on=["utility_id_ferc1", "plant_name_ferc1"], how='left')
.assign(capacity_factor=lambda x: (
x.net_generation_mwh / (8760 * x.capacity_mw)))
.pipe(pudl.helpers.organize_cols, ["report_year",
Expand All @@ -183,7 +184,7 @@ def plants_pumped_storage_ferc1(pudl_engine):
pumped_storage_df = (
pd.read_sql_table("plants_pumped_storage_ferc1", pudl_engine)
.merge(pudl.output.ferc1.plants_utils_ferc1(pudl_engine),
on=["utility_id_ferc1", "plant_name_ferc1"])
on=["utility_id_ferc1", "plant_name_ferc1"], how='left')
.assign(capacity_factor=lambda x:
x.net_generation_mwh / (8760 * x.capacity_mw))
.pipe(pudl.helpers.organize_cols, ["report_year",
Expand Down