[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
756a814c63
commit
74e9d56adb
@ -120,11 +120,13 @@ def calculate_annuity(n, r):
|
|||||||
else:
|
else:
|
||||||
return 1 / n
|
return 1 / n
|
||||||
|
|
||||||
|
|
||||||
def add_missing_carrier(n):
|
def add_missing_carrier(n):
|
||||||
components = [n.buses, n.generators, n.lines, n.links, n.storage_units, n.stores]
|
components = [n.buses, n.generators, n.lines, n.links, n.storage_units, n.stores]
|
||||||
for c in components:
|
for c in components:
|
||||||
missing_carrier = np.setdiff1d(c.carrier.unique(),n.carriers.index)
|
missing_carrier = np.setdiff1d(c.carrier.unique(), n.carriers.index)
|
||||||
n.madd("Carrier",missing_carrier)
|
n.madd("Carrier", missing_carrier)
|
||||||
|
|
||||||
|
|
||||||
def _add_missing_carriers_from_costs(n, costs, carriers):
|
def _add_missing_carriers_from_costs(n, costs, carriers):
|
||||||
missing_carriers = pd.Index(carriers).difference(n.carriers.index)
|
missing_carriers = pd.Index(carriers).difference(n.carriers.index)
|
||||||
|
@ -22,8 +22,8 @@ import numpy as np
|
|||||||
import pypsa
|
import pypsa
|
||||||
import xarray as xr
|
import xarray as xr
|
||||||
from _helpers import override_component_attrs, update_config_with_sector_opts
|
from _helpers import override_component_attrs, update_config_with_sector_opts
|
||||||
from prepare_sector_network import cluster_heat_buses, define_spatial, prepare_costs
|
|
||||||
from add_electricity import add_missing_carrier
|
from add_electricity import add_missing_carrier
|
||||||
|
from prepare_sector_network import cluster_heat_buses, define_spatial, prepare_costs
|
||||||
|
|
||||||
cc = coco.CountryConverter()
|
cc = coco.CountryConverter()
|
||||||
|
|
||||||
|
@ -57,8 +57,8 @@ import pandas as pd
|
|||||||
import pypsa
|
import pypsa
|
||||||
from _helpers import configure_logging
|
from _helpers import configure_logging
|
||||||
from add_electricity import (
|
from add_electricity import (
|
||||||
add_missing_carrier,
|
|
||||||
_add_missing_carriers_from_costs,
|
_add_missing_carriers_from_costs,
|
||||||
|
add_missing_carrier,
|
||||||
add_nice_carrier_names,
|
add_nice_carrier_names,
|
||||||
load_costs,
|
load_costs,
|
||||||
)
|
)
|
||||||
@ -121,7 +121,7 @@ def attach_stores(n, costs, elec_opts):
|
|||||||
capital_cost=costs.at["hydrogen storage underground", "capital_cost"],
|
capital_cost=costs.at["hydrogen storage underground", "capital_cost"],
|
||||||
)
|
)
|
||||||
|
|
||||||
n.madd("Carrier",["H2 electrolysis","H2 fuel cell"])
|
n.madd("Carrier", ["H2 electrolysis", "H2 fuel cell"])
|
||||||
|
|
||||||
n.madd(
|
n.madd(
|
||||||
"Link",
|
"Link",
|
||||||
@ -165,7 +165,7 @@ def attach_stores(n, costs, elec_opts):
|
|||||||
marginal_cost=costs.at["battery", "marginal_cost"],
|
marginal_cost=costs.at["battery", "marginal_cost"],
|
||||||
)
|
)
|
||||||
|
|
||||||
n.madd("Carrier",["battery charger","battery discharger"])
|
n.madd("Carrier", ["battery charger", "battery discharger"])
|
||||||
|
|
||||||
n.madd(
|
n.madd(
|
||||||
"Link",
|
"Link",
|
||||||
@ -218,7 +218,7 @@ def attach_hydrogen_pipelines(n, costs, elec_opts):
|
|||||||
h2_links.index = h2_links.apply(lambda c: f"H2 pipeline {c.bus0}-{c.bus1}", axis=1)
|
h2_links.index = h2_links.apply(lambda c: f"H2 pipeline {c.bus0}-{c.bus1}", axis=1)
|
||||||
|
|
||||||
# add pipelines
|
# add pipelines
|
||||||
n.add("Carrier","H2 pipeline")
|
n.add("Carrier", "H2 pipeline")
|
||||||
|
|
||||||
n.madd(
|
n.madd(
|
||||||
"Link",
|
"Link",
|
||||||
|
@ -714,7 +714,7 @@ def base_network(
|
|||||||
n.name = "PyPSA-Eur"
|
n.name = "PyPSA-Eur"
|
||||||
|
|
||||||
n.set_snapshots(pd.date_range(freq="h", **config["snapshots"]))
|
n.set_snapshots(pd.date_range(freq="h", **config["snapshots"]))
|
||||||
n.madd("Carrier",["AC","DC"])
|
n.madd("Carrier", ["AC", "DC"])
|
||||||
|
|
||||||
n.import_components_from_dataframe(buses, "Bus")
|
n.import_components_from_dataframe(buses, "Bus")
|
||||||
n.import_components_from_dataframe(lines, "Line")
|
n.import_components_from_dataframe(lines, "Line")
|
||||||
|
@ -22,6 +22,7 @@ from _helpers import (
|
|||||||
override_component_attrs,
|
override_component_attrs,
|
||||||
update_config_with_sector_opts,
|
update_config_with_sector_opts,
|
||||||
)
|
)
|
||||||
|
from add_electricity import add_missing_carrier
|
||||||
from build_energy_totals import build_co2_totals, build_eea_co2, build_eurostat_co2
|
from build_energy_totals import build_co2_totals, build_eea_co2, build_eurostat_co2
|
||||||
from networkx.algorithms import complement
|
from networkx.algorithms import complement
|
||||||
from networkx.algorithms.connectivity.edge_augmentation import k_edge_augmentation
|
from networkx.algorithms.connectivity.edge_augmentation import k_edge_augmentation
|
||||||
@ -29,7 +30,6 @@ from pypsa.geo import haversine_pts
|
|||||||
from pypsa.io import import_components_from_dataframe
|
from pypsa.io import import_components_from_dataframe
|
||||||
from scipy.stats import beta
|
from scipy.stats import beta
|
||||||
from vresutils.costdata import annuity
|
from vresutils.costdata import annuity
|
||||||
from add_electricity import add_missing_carrier
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user