[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
ec4e9aa548
commit
446b0b3722
@ -13,9 +13,7 @@ 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, generate_periodic_profiles
|
||||||
from _helpers import configure_logging
|
|
||||||
from _helpers import generate_periodic_profiles
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -137,8 +135,10 @@ def bev_availability_profile(fn, snapshots, nodes, options):
|
|||||||
)
|
)
|
||||||
|
|
||||||
if not avail[avail < 0].empty:
|
if not avail[avail < 0].empty:
|
||||||
logger.warning("The BEV availability weekly profile has negative values which can "
|
logger.warning(
|
||||||
"lead to infeasibility.")
|
"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,
|
||||||
|
@ -1324,7 +1324,7 @@ def add_storage_and_grids(n, costs):
|
|||||||
n, "H2 pipeline ", carriers=["DC", "gas pipeline"]
|
n, "H2 pipeline ", carriers=["DC", "gas pipeline"]
|
||||||
)
|
)
|
||||||
|
|
||||||
h2_pipes["p_nom"] = 0.
|
h2_pipes["p_nom"] = 0.0
|
||||||
|
|
||||||
if snakemake.input.get("custom_h2_pipelines"):
|
if snakemake.input.get("custom_h2_pipelines"):
|
||||||
fn = snakemake.input.custom_h2_pipelines
|
fn = snakemake.input.custom_h2_pipelines
|
||||||
@ -1333,8 +1333,14 @@ def add_storage_and_grids(n, costs):
|
|||||||
h2_pipes = pd.concat([h2_pipes, wkn])
|
h2_pipes = pd.concat([h2_pipes, wkn])
|
||||||
|
|
||||||
# drop duplicates according to buses (order can be different) and keep pipe with highest p_nom
|
# drop duplicates according to buses (order can be different) and keep pipe with highest p_nom
|
||||||
h2_pipes['buses_sorted'] = h2_pipes.apply(lambda row: tuple(sorted([row['bus0'], row['bus1']])), axis=1)
|
h2_pipes["buses_sorted"] = h2_pipes.apply(
|
||||||
h2_pipes = h2_pipes.sort_values('p_nom').drop_duplicates(subset=['buses_sorted'], keep='last').drop(columns = 'buses_sorted')
|
lambda row: tuple(sorted([row["bus0"], row["bus1"]])), axis=1
|
||||||
|
)
|
||||||
|
h2_pipes = (
|
||||||
|
h2_pipes.sort_values("p_nom")
|
||||||
|
.drop_duplicates(subset=["buses_sorted"], keep="last")
|
||||||
|
.drop(columns="buses_sorted")
|
||||||
|
)
|
||||||
|
|
||||||
# TODO Add efficiency losses
|
# TODO Add efficiency losses
|
||||||
n.madd(
|
n.madd(
|
||||||
|
Loading…
Reference in New Issue
Block a user