handle leap days in add_brownfield

This commit is contained in:
Fabian Neumann 2024-03-14 18:46:45 +01:00
parent 8d85acc61a
commit 02fc334a2e
2 changed files with 3 additions and 1 deletions

View File

@ -70,6 +70,7 @@ rule add_brownfield:
),
threshold_capacity=config_provider("existing_capacities", " threshold_capacity"),
snapshots=config_provider("snapshots"),
drop_leap_day=config_provider("enable", "drop_leap_day"),
carriers=config_provider("electricity", "renewable_carriers"),
input:
unpack(input_profile_tech_brownfield),

View File

@ -14,6 +14,7 @@ import pypsa
import xarray as xr
from _helpers import (
configure_logging,
get_snapshots
set_scenario_config,
update_config_from_wildcards,
)
@ -192,7 +193,7 @@ def adjust_renewable_profiles(n, input_profiles, params, year):
clustermaps.index = clustermaps.index.astype(str)
# temporal clustering
dr = pd.date_range(**params["snapshots"], freq="h")
dr = get_snapshots(params["snapshots"], params["drop_leap_day"])
snapshotmaps = (
pd.Series(dr, index=dr).where(lambda x: x.isin(n.snapshots), pd.NA).ffill()
)