Import function, black formatting
@@ -6,7 +6,12 @@ import logging
from pathlib import Path
import pandas as pd
-from powergenome.util import regions_to_keep, reverse_dict_of_lists, shift_wrap_profiles
+from powergenome.util import (
+ regions_to_keep,
+ reverse_dict_of_lists,
+ shift_wrap_profiles,
+ remove_feb_29,
+)
from powergenome.external_data import make_demand_response_profiles
from powergenome.eia_opendata import get_aeo_load
@@ -73,7 +78,9 @@ def add_load_growth(load_curves: pd.DataFrame, settings: dict) -> pd.DataFrame:
region=hist_region_map[ipm_region],
aeo_year=2014,
scenario_series="REF2014",
- ).set_index("year").loc[2012, "demand"]
+ )
+ .set_index("year")
+ .loc[2012, "demand"]
for ipm_region in keep_regions
}
hist_demand_end = {
@@ -81,7 +88,9 @@ def add_load_growth(load_curves: pd.DataFrame, settings: dict) -> pd.DataFrame:
region=hist_region_map[ipm_region],
aeo_year=2019,
scenario_series="REF2019",
- ).set_index("year").loc[2018, "demand"]
+ )
+ .set_index("year")
+ .loc[2018, "demand"]
for ipm_region in keep_regions
}
@@ -95,7 +104,9 @@ def add_load_growth(load_curves: pd.DataFrame, settings: dict) -> pd.DataFrame:
}
load_growth_start_map = {
- ipm_region: _df.loc[settings.get("regular_load_growth_start_year", 2019), "demand"]
+ ipm_region: _df.loc[
+ settings.get("regular_load_growth_start_year", 2019), "demand"
+ ]
for ipm_region, _df in load_growth_dict.items()
}
@@ -113,17 +124,15 @@ def add_load_growth(load_curves: pd.DataFrame, settings: dict) -> pd.DataFrame:
for ipm_region in keep_regions
}
- years_growth = (
- settings["model_year"] - settings["regular_load_growth_start_year"]
- )
+ years_growth = settings["model_year"] - settings["regular_load_growth_start_year"]
for region, rate in (settings.get("alt_growth_rate") or {}).items():
future_growth_factor[region] = (1 + rate) ** years_growth
for region in keep_regions:
- load_curves.loc[
- load_curves["region_id_epaipm"] == region, "load_mw"
- ] *= (hist_growth_factor[region] * future_growth_factor[region])
+ load_curves.loc[load_curves["region_id_epaipm"] == region, "load_mw"] *= (
+ hist_growth_factor[region] * future_growth_factor[region]
+ )
return load_curves
