patio.data.entity_ids¶
Attributes¶
Functions¶
|
Add respondent and final ba_codes. |
|
Process for assigning plants to EIA BA codes and FERC 1 Respondent IDs. |
Module Contents¶
- patio.data.entity_ids.RESPS_TO_KEEP = (130, 177, 186, 195, 210, 22, 531, 552, 556, 58, 656, 658)[source]¶
- patio.data.entity_ids.add_ba_code(input_df, new_ba_col='final_ba_code', *, ba_rollup_only=False, drop_interim=False, apply_purchaser=True)[source]¶
Add respondent and final ba_codes.
Steps if
ba_rollup_onlyis False. If it is True, we simply apply theBA_REPLACEmap tobalancing_authority_code_eia. 1. First we read in UTH utility information which associatesutility_id_eiato FERC
respondent_id. In that dataset we grab those two columns, drop rows where either is null and remove duplicates. For the next step it is critical that a givenutility_id_eiamap to one and only onerespondent_id, though multipleutility_id_eiacan map to single arespondent_id.We then merge the result of (1) onto the incoming
pandas.DataFrame[Optional if applying purchaser data] Read in UTH purchased power data, select only purchase data from 2020 (the last manually tagged year) where
plant_id_eiais not null, i.e. cases where the purchased power tagging found a plant-level match. This data will allow us to associateplant_id_eiawith therespondent_idthat purchases its power. To make this unique we require that therespondent_idpurchases ≥90% of power that the plant sells (NOTE: this is not as a % of the total plant generation, just that plant’s sales that we have identified in the purchase power tagging process). We then merge this onto the result of (2) onplant_id_eia. The resultingfinal_respondent_idfor aplant_id_eiaonly uses therespondent_id_purchaserif thatplant_id_eiadid not have arespondent_idassigned in step (2).The final step is to adjust the final ba codes using
adjust_ba_codes(). This process attempts to group the rows ofinput_dfinto planning areas by doing one of the following:Using the
final_respondent_idirrespective of a given row’sbalancing_authority_code_eia.Using the
balancing_authority_code_eiairrespective of a given row’sfinal_respondent_id.
Combining one or more
balancing_authority_code_eiainto a single new region.Doing something more complicated (see
adjust_ba_codes()body for the 8 special cases).
- Parameters:
input_df (pandas.DataFrame) – frame to add BA / respondent columns to
new_ba_col (str) – name of ultimate BA code column
ba_rollup_only (bool) – if True, we only rollup EIA BA codes using
BA_REPLACEdrop_interim (bool) – if True, drop all the intermediate respondent / BA code columns
apply_purchaser (bool) – if True, change respondent to respondent of purchaser, requires plant_id_eia
Returns:
- patio.data.entity_ids.adjust_ba_codes(df, new_ba_col='final_ba_code')[source]¶
Process for assigning plants to EIA BA codes and FERC 1 Respondent IDs.
- Parameters:
df (pandas.DataFrame)
- Return type: