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 column mapping for proposed multifuel table #3988

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open
1 change: 1 addition & 0 deletions src/pudl/extract/eia860.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ def get_dtypes(page, **partition):
"raw_eia860__generator_wind_existing",
"raw_eia860__generator_wind_retired",
"raw_eia860__multifuel_existing",
"raw_eia860__multifuel_proposed",
"raw_eia860__multifuel_retired",
"raw_eia860__ownership",
"raw_eia860__plant",
Expand Down
53 changes: 53 additions & 0 deletions src/pudl/package_data/eia860/column_maps/multifuel_proposed.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
year_index,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020,2021,2022,2023
utility_id_eia,utilcode,utilcode,utilcode,utilcode,utilcode,utility_id,utility_id,utility_id,utility_id,utility_id,utility_id,utility_id,utility_id,utility_id,utility_id,utility_id,utility_id,utility_id,utility_id,utility_id
utility_name_eia,utilname,utilname,utilname,utilname,utilname,utility_name,utility_name,utility_name,utility_name,utility_name,utility_name,utility_name,utility_name,utility_name,utility_name,utility_name,utility_name,utility_name,utility_name,utility_name
plant_id_eia,plntcode,plntcode,plntcode,plntcode,plntcode,plant_code,plant_code,plant_code,plant_code,plant_code,plant_code,plant_code,plant_code,plant_code,plant_code,plant_code,plant_code,plant_code,plant_code,plant_code
plant_name_eia,plntname,plntname,plntname,plntname,plntname,plant_name,plant_name,plant_name,plant_name,plant_name,plant_name,plant_name,plant_name,plant_name,plant_name,plant_name,plant_name,plant_name,plant_name,plant_name
state,state,state,state,state,state,state,state,state,state,state,state,state,state,state,state,state,state,state,state,state
county,,,,,,county,county,county,county,county,county,county,county,county,county,county,county,county,county,county
generator_id,gencode,gencode,gencode,gencode,gencode,generator_id,generator_id,generator_id,generator_id,generator_id,generator_id,generator_id,generator_id,generator_id,generator_id,generator_id,generator_id,generator_id,generator_id,generator_id
operational_status_code,,,,,,,,status,status,status,status,status,status,status,status,status,status,status,status,status
technology_description,,,,,,,,,,,technology,technology,technology,technology,technology,technology,technology,technology,technology,technology
prime_mover_code,primemover,primemover,primemover,primemover,primemover,prime_mover,prime_mover,prime_mover,prime_mover,prime_mover,prime_mover,prime_mover,prime_mover,prime_mover,prime_mover,prime_mover,prime_mover,prime_mover,prime_mover,prime_mover
sector_name_eia,,,,,,,,sector_name,sector_name,sector_name,sector_name,sector_name,sector_name,sector_name,sector_name,sector_name,sector_name,sector_name,sector_name,sector_name
sector_id_eia,,,,,,,,sector,sector,sector,sector,sector,sector,sector,sector,sector,sector,sector,sector,sector
capacity_mw,,,,,,,,,,nameplate_capacity_mw,nameplate_capacity_mw,nameplate_capacity_mw,nameplate_capacity_mw,nameplate_capacity_mw,nameplate_capacity_mw,nameplate_capacity_mw,nameplate_capacity_mw,nameplate_capacity_mw,nameplate_capacity_mw,nameplate_capacity_mw
summer_capacity_mw,,,,,,,,,,summer_capacity_mw,summer_capacity_mw,summer_capacity_mw,summer_capacity_mw,summer_capacity_mw,summer_capacity_mw,summer_capacity_mw,summer_capacity_mw,summer_capacity_mw,summer_capacity_mw,summer_capacity_mw
winter_capacity_mw,,,,,,,,,,winter_capacity_mw,winter_capacity_mw,winter_capacity_mw,winter_capacity_mw,winter_capacity_mw,winter_capacity_mw,winter_capacity_mw,winter_capacity_mw,winter_capacity_mw,winter_capacity_mw,winter_capacity_mw
generator_operating_month,,,,,,,,,,,,,,current_month,current_month,current_month,current_month,current_month,current_month,current_month
generator_operating_year,,,,,,,,,,,,,,current_year,current_year,current_year,current_year,current_year,current_year,current_year
energy_source_code_1,,,,,,,,,,energy_source_1,energy_source_1,energy_source_1,energy_source_1,energy_source_1,energy_source_1,energy_source_1,energy_source_1,energy_source_1,energy_source_1,energy_source_1
energy_source_code_2,,,,,,,,,,energy_source_2,energy_source_2,energy_source_2,energy_source_2,energy_source_2,energy_source_2,energy_source_2,energy_source_2,energy_source_2,energy_source_2,energy_source_2
multiple_fuels,pro_multiple_fuels,pro_multiple_fuels,pro_multiple_fuels,multiple_fuels,multiple_fuels,multiple_fuels,multiple_fuels,multiple_fuels,multiple_fuels,,,,multiple_fuels,multiple_fuels,multiple_fuels,multiple_fuels,multiple_fuels,multiple_fuels,multiple_fuels,multiple_fuels
cofire_fuels,pro_cofire_fuels,pro_cofire_fuels,pro_cofire_fuels,cofire_fuels,cofire_fuels,cofire_fuels,cofire_fuels,cofire_fuels,cofire_fuels,cofire_fuels,cofire_fuels,cofire_fuels,cofire_fuels,cofire_fuels,cofire_fuels,cofire_fuels,cofire_fuels,cofire_fuels,cofire_fuels,cofire_fuels
cofire_energy_source_1,prop_cofire_energy_source_1,prop_cofire_energy_source_1,prop_cofire_energy_source_1,cofire_energy_source_1,cofire_energy_source_1,cofire_energy_source_1,cofire_energy_source_1,cofire_energy_source_1,cofire_energy_source_1,cofire_energy_source_1,cofire_energy_source_1,cofire_energy_source_1,cofire_energy_source_1,cofire_energy_source_1,cofire_energy_source_1,cofire_energy_source_1,cofire_energy_source_1,cofire_energy_source_1,cofire_energy_source_1,cofire_energy_source_1
cofire_energy_source_2,prop_cofire_energy_source_2,prop_cofire_energy_source_2,prop_cofire_energy_source_2,cofire_energy_source_2,cofire_energy_source_2,cofire_energy_source_2,cofire_energy_source_2,cofire_energy_source_2,cofire_energy_source_2,cofire_energy_source_2,cofire_energy_source_2,cofire_energy_source_2,cofire_energy_source_2,cofire_energy_source_2,cofire_energy_source_2,cofire_energy_source_2,cofire_energy_source_2,cofire_energy_source_2,cofire_energy_source_2,cofire_energy_source_2
cofire_energy_source_3,prop_cofire_energy_source_3,prop_cofire_energy_source_3,prop_cofire_energy_source_3,cofire_energy_source_3,cofire_energy_source_3,cofire_energy_source_3,cofire_energy_source_3,cofire_energy_source_3,cofire_energy_source_3,cofire_energy_source_3,cofire_energy_source_3,cofire_energy_source_3,cofire_energy_source_3,cofire_energy_source_3,cofire_energy_source_3,cofire_energy_source_3,cofire_energy_source_3,cofire_energy_source_3,cofire_energy_source_3,cofire_energy_source_3
cofire_energy_source_4,prop_cofire_energy_source_4,prop_cofire_energy_source_4,prop_cofire_energy_source_4,cofire_energy_source_4,cofire_energy_source_4,cofire_energy_source_4,cofire_energy_source_4,cofire_energy_source_4,cofire_energy_source_4,cofire_energy_source_4,cofire_energy_source_4,cofire_energy_source_4,cofire_energy_source_4,cofire_energy_source_4,cofire_energy_source_4,cofire_energy_source_4,cofire_energy_source_4,cofire_energy_source_4,cofire_energy_source_4,cofire_energy_source_4
cofire_energy_source_5,prop_cofire_energy_source_5,prop_cofire_energy_source_5,prop_cofire_energy_source_5,cofire_energy_source_5,cofire_energy_source_5,cofire_energy_source_5,cofire_energy_source_5,cofire_energy_source_5,cofire_energy_source_5,cofire_energy_source_5,cofire_energy_source_5,cofire_energy_source_5,cofire_energy_source_5,cofire_energy_source_5,cofire_energy_source_5,cofire_energy_source_5,cofire_energy_source_5,cofire_energy_source_5,cofire_energy_source_5,cofire_energy_source_5
cofire_energy_source_6,prop_cofire_energy_source_6,prop_cofire_energy_source_6,prop_cofire_energy_source_6,cofire_energy_source_6,cofire_energy_source_6,cofire_energy_source_6,cofire_energy_source_6,cofire_energy_source_6,cofire_energy_source_6,cofire_energy_source_6,cofire_energy_source_6,cofire_energy_source_6,cofire_energy_source_6,cofire_energy_source_6,cofire_energy_source_6,cofire_energy_source_6,cofire_energy_source_6,cofire_energy_source_6,cofire_energy_source_6,cofire_energy_source_6
switch_oil_gas,prop_fuel_switch_oil_gas,prop_fuel_switch_oil_gas,prop_fuel_switch_oil_gas,fuel_switch_oil_gas,fuel_switch_oil_gas,fuel_switch_oil_gas,fuel_switch_oil_gas,fuel_switch_oil_gas,fuel_switch_oil_gas,switch_between_oil_and_natural_gas,switch_between_oil_and_natural_gas,switch_between_oil_and_natural_gas,switch_between_oil_and_natural_gas,switch_between_oil_and_natural_gas,switch_between_oil_and_natural_gas,switch_between_oil_and_natural_gas,switch_between_oil_and_natural_gas,switch_between_oil_and_natural_gas,switch_between_oil_and_natural_gas,switch_between_oil_and_natural_gas
switch_when_operating,,,,,,operating_switch,operating_switch,operating_switch,operating_switch,,,,,,,,,,,
net_summer_capacity_with_natural_gas_mw,prop_net_summer_capacity_ng,prop_net_summer_capacity_ng,prop_net_summer_capacity_ng,net_summer_capacity_ng,net_summer_capacity_ng,net_summer_capacity_ng,net_summer_capacity_ng,net_summer_capacity_ng,net_summer_capacity_with_natural_gas_mw,,,,,,,,,,,
net_winter_capacity_with_natural_gas_mw,,,,,,,,,,,,,,,,,,,,
jmelot marked this conversation as resolved.
Show resolved Hide resolved
net_summer_capacity_with_oil_mw,prop_net_summer_capacity_oil,prop_net_summer_capacity_oil,prop_net_summer_capacity_oil,net_summer_capacity_oil,net_summer_capacity_oil,net_summer_capacity_oil,net_summer_capacity_oil,net_summer_capacity_oil,net_summer_capacity_with_oil_mw,,,,,,,,,,,
net_winter_capacity_with_oil_mw,,,,,,,,,,,,,,,,,,,,
time_to_switch_from_gas_to_oil,,,,,,,,,,,,,,,,,,,,
time_to_switch_from_oil_to_gas,,,,,,,,,,,,,,,,,,,,
factors_that_limit_switching,,,,factors_that_limit,factors_that_limit,,,,,,,,,,,,,,,
storage_limits,,,,storage_limits,storage_limits,storage_limits,storage_limits,storage_limits,storage_limits,,,,,,,,,,,
air_permit_limits,,,,airpermit_limits,airpermit_limits,airpermit_limits,airpermit_limits,airpermit_limits,air_permit_limits,,,,,,,,,,,
other_limits,,,,other_limits,other_limits,other_limits,other_limits,other_limits,other_limits,,,,,,,,,,,
cofire_oil_and_gas,prop_cofire_oil_gas,prop_cofire_oil_gas,prop_cofire_oil_gas,cofire_oil_gas,cofire_oil_gas,cofire_oil_gas,cofire_oil_gas,cofire_oil_gas,cofire_oil_and_gas,,,,,,,,,,,
cofire_100_oil,prop_cofire_100_oil,prop_cofire_100_oil,prop_cofire_100_oil,cofire_100_oil,cofire_100_oil,cofire_100_oil,cofire_100_oil,cofire_100_oil,cofire_100_oil,,,,,,,,,,,
max_oil_heat_input,prop_max_oil_heat,prop_max_oil_heat,prop_max_oil_heat,max_oil_heat,max_oil_heat,max_oil_heat,max_oil_heat,max_oil_heat,max_oil_heat_input,,,,,,,,,,,
max_oil_output_mw,prop_max_oil_output,prop_max_oil_output,prop_max_oil_output,max_oil_output,max_oil_output,max_oil_output,max_oil_output,max_oil_output,max_oil_output_mw,,,,,,,,,,,
fuel_switch,prop_fuel_switch,prop_fuel_switch,prop_fuel_switch,fuel_switch,fuel_switch,fuel_switch,fuel_switch,fuel_switch,fuel_switch,,,,,,,,,,,
time_to_switch,prop_time_to_switch,prop_time_to_switch,prop_time_to_switch,time_to_switch,time_to_switch,time_to_switch,time_to_switch,time_to_switch,time_to_switch,,,,,,,,,,,
regulatory_limits,prop_regulatory_limits,prop_regulatory_limits,prop_regulatory_limits,,,regulatory_limits,regulatory_limits,regulatory_limits,regulatory_limits,,,,,,,,,,,
fuel_switch_energy_source_1,prop_fuel_switch_es1,prop_fuel_switch_es1,prop_fuel_switch_es1,fuel_switch_energy_source_1,fuel_switch_energy_source_1,fuel_switch_energy_source_1,fuel_switch_energy_source_1,fuel_switch_energy_source_1,fuel_switch_energy_source_1,,,,,,,,,,,
fuel_switch_energy_source_2,prop_fuel_switch_es2,prop_fuel_switch_es2,prop_fuel_switch_es2,fuel_switch_energy_source_2,fuel_switch_energy_source_2,fuel_switch_energy_source_2,fuel_switch_energy_source_2,fuel_switch_energy_source_2,fuel_switch_energy_source_2,,,,,,,,,,,
fuel_switch_energy_source_3,prop_fuel_switch_es3,prop_fuel_switch_es3,prop_fuel_switch_es3,fuel_switch_energy_source_3,fuel_switch_energy_source_3,fuel_switch_energy_source_3,fuel_switch_energy_source_3,fuel_switch_energy_source_3,fuel_switch_energy_source_3,,,,,,,,,,,
fuel_switch_energy_source_4,prop_fuel_switch_es4,prop_fuel_switch_es4,prop_fuel_switch_es4,fuel_switch_energy_source_4,fuel_switch_energy_source_4,fuel_switch_energy_source_4,fuel_switch_energy_source_4,fuel_switch_energy_source_4,fuel_switch_energy_source_4,,,,,,,,,,,
fuel_switch_energy_source_5,prop_fuel_switch_es5,prop_fuel_switch_es5,prop_fuel_switch_es5,fuel_switch_energy_source_5,fuel_switch_energy_source_5,fuel_switch_energy_source_5,fuel_switch_energy_source_5,fuel_switch_energy_source_5,fuel_switch_energy_source_5,,,,,,,,,,,
fuel_switch_energy_source_6,prop_fuel_switch_es6,prop_fuel_switch_es6,prop_fuel_switch_es6,fuel_switch_energy_source_6,fuel_switch_energy_source_6,fuel_switch_energy_source_6,fuel_switch_energy_source_6,fuel_switch_energy_source_6,fuel_switch_energy_source_6,,,,,,,,,,,
1 change: 1 addition & 0 deletions src/pudl/transform/eia.py
Original file line number Diff line number Diff line change
Expand Up @@ -1346,5 +1346,6 @@ def finished_eia_asset(**kwargs) -> pd.DataFrame:
"core_eia860__scd_generators_wind": "_core_eia860__generators_wind",
"core_eia860__scd_generators_solar": "_core_eia860__generators_solar",
"core_eia860__scd_generators_energy_storage": "_core_eia860__generators_energy_storage",
"core_eia860__multifuel": "_core_eia860__multifuel",
jmelot marked this conversation as resolved.
Show resolved Hide resolved
}.items()
]
60 changes: 60 additions & 0 deletions src/pudl/transform/eia860.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,66 @@ def _core_eia860__generators_wind(
return wind_df


# TODO: ask about generator_operating_month vs current_month and year
# also ask how the initial column mapping happens
aesharpe marked this conversation as resolved.
Show resolved Hide resolved
@asset
def _core_eia860__multifuel(
raw_eia860__multifuel_existing: pd.DataFrame,
raw_eia860__multifuel_proposed: pd.DataFrame,
raw_eia860__multifuel_retired: pd.DataFrame,
) -> pd.DataFrame:
"""Transform the multifuel generators table."""
multifuel_ex = raw_eia860__multifuel_existing
multifuel_pr = raw_eia860__multifuel_proposed
multifuel_re = raw_eia860__multifuel_retired

boolean_columns_to_fix = [
"air_permit_limits",
"cofire_fuels",
"factors_that_limit_switching",
"multiple_fuels",
"other_limits",
"storage_limits",
"switch_oil_gas",
"switch_when_operating",
]

# A subset of the columns have zero values, where NA is appropriate:
nulls_replace_cols = {
col: {" ": np.nan, 0: np.nan}
for col in [
"winter_capacity_mw",
"summer_capacity_mw",
]
}

multifuel_df = (
pd.concat([multifuel_ex, multifuel_pr, multifuel_re], sort=True)
.dropna(subset=["generator_id", "plant_id_eia"])
.pipe(pudl.helpers.fix_eia_na)
.pipe(
pudl.helpers.fix_boolean_columns,
boolean_columns_to_fix=boolean_columns_to_fix,
)
.replace(to_replace=nulls_replace_cols)
.pipe(pudl.helpers.month_year_to_date)
.pipe(PUDL_PACKAGE.encode)
)

multifuel_df["fuel_type_code_pudl"] = (
multifuel_df.energy_source_code_1.str.upper().map(
pudl.helpers.label_map(
CODE_METADATA["core_eia__codes_energy_sources"]["df"],
from_col="code",
to_col="fuel_type_code_pudl",
null_value=pd.NA,
)
)
)

aesharpe marked this conversation as resolved.
Show resolved Hide resolved
return multifuel_df


@asset
def _core_eia860__plants(raw_eia860__plant: pd.DataFrame) -> pd.DataFrame:
"""Pull and transform the plants table.
Expand Down
Loading