Merge branch 'feature/warning-bev-profile' of github.com:Climact/pypsa-eur-climact into Climact-feature/warning-bev-profile

This commit is contained in:
Fabian Neumann 2024-01-17 10:07:21 +01:00
commit 59a92f686b
2 changed files with 13 additions and 0 deletions

View File

@ -16,6 +16,8 @@ Upcoming Release
* Bugfix: Assure entering of code block which corrects Norwegian heat demand. * Bugfix: Assure entering of code block which corrects Norwegian heat demand.
* Add warning when BEV availability weekly profile has negative values in `build_transport_demand`.
PyPSA-Eur 0.9.0 (5th January 2024) PyPSA-Eur 0.9.0 (5th January 2024)
================================== ==================================

View File

@ -8,11 +8,17 @@ improvements due to drivetrain changes, time series for electric vehicle
availability and demand-side management constraints. availability and demand-side management constraints.
""" """
import logging
import numpy as np import numpy as np
import pandas as pd import pandas as pd
import xarray as xr import xarray as xr
from _helpers import configure_logging
from _helpers import generate_periodic_profiles from _helpers import generate_periodic_profiles
logger = logging.getLogger(__name__)
def build_nodal_transport_data(fn, pop_layout): def build_nodal_transport_data(fn, pop_layout):
transport_data = pd.read_csv(fn, index_col=0) transport_data = pd.read_csv(fn, index_col=0)
@ -130,6 +136,10 @@ def bev_availability_profile(fn, snapshots, nodes, options):
traffic.mean() - traffic.min() traffic.mean() - traffic.min()
) )
if not avail[avail < 0].empty:
logger.warning("The BEV availability weekly profile has negative values which can "
"lead to infeasibility.")
return generate_periodic_profiles( return generate_periodic_profiles(
dt_index=snapshots, dt_index=snapshots,
nodes=nodes, nodes=nodes,
@ -160,6 +170,7 @@ if __name__ == "__main__":
simpl="", simpl="",
clusters=48, clusters=48,
) )
configure_logging(snakemake)
pop_layout = pd.read_csv(snakemake.input.clustered_pop_layout, index_col=0) pop_layout = pd.read_csv(snakemake.input.clustered_pop_layout, index_col=0)