[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:
|
||||
return 1 / n
|
||||
|
||||
|
||||
def add_missing_carrier(n):
|
||||
components = [n.buses, n.generators, n.lines, n.links, n.storage_units, n.stores]
|
||||
for c in components:
|
||||
missing_carrier = np.setdiff1d(c.carrier.unique(),n.carriers.index)
|
||||
n.madd("Carrier",missing_carrier)
|
||||
missing_carrier = np.setdiff1d(c.carrier.unique(), n.carriers.index)
|
||||
n.madd("Carrier", missing_carrier)
|
||||
|
||||
|
||||
def _add_missing_carriers_from_costs(n, costs, carriers):
|
||||
missing_carriers = pd.Index(carriers).difference(n.carriers.index)
|
||||
@ -837,7 +839,7 @@ if __name__ == "__main__":
|
||||
estimate_renewable_capacities(n, snakemake.config)
|
||||
|
||||
update_p_nom_max(n)
|
||||
|
||||
|
||||
add_missing_carrier(n)
|
||||
add_nice_carrier_names(n, snakemake.config)
|
||||
|
||||
|
@ -22,8 +22,8 @@ import numpy as np
|
||||
import pypsa
|
||||
import xarray as xr
|
||||
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 prepare_sector_network import cluster_heat_buses, define_spatial, prepare_costs
|
||||
|
||||
cc = coco.CountryConverter()
|
||||
|
||||
@ -667,7 +667,7 @@ if __name__ == "__main__":
|
||||
cluster_heat_buses(n)
|
||||
|
||||
n.meta = dict(snakemake.config, **dict(wildcards=dict(snakemake.wildcards)))
|
||||
|
||||
|
||||
add_missing_carrier(n)
|
||||
|
||||
n.export_to_netcdf(snakemake.output[0])
|
||||
|
@ -57,8 +57,8 @@ import pandas as pd
|
||||
import pypsa
|
||||
from _helpers import configure_logging
|
||||
from add_electricity import (
|
||||
add_missing_carrier,
|
||||
_add_missing_carriers_from_costs,
|
||||
add_missing_carrier,
|
||||
add_nice_carrier_names,
|
||||
load_costs,
|
||||
)
|
||||
@ -120,8 +120,8 @@ def attach_stores(n, costs, elec_opts):
|
||||
e_cyclic=True,
|
||||
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(
|
||||
"Link",
|
||||
@ -164,8 +164,8 @@ def attach_stores(n, costs, elec_opts):
|
||||
capital_cost=costs.at["battery storage", "capital_cost"],
|
||||
marginal_cost=costs.at["battery", "marginal_cost"],
|
||||
)
|
||||
|
||||
n.madd("Carrier",["battery charger","battery discharger"])
|
||||
|
||||
n.madd("Carrier", ["battery charger", "battery discharger"])
|
||||
|
||||
n.madd(
|
||||
"Link",
|
||||
@ -218,8 +218,8 @@ 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)
|
||||
|
||||
# add pipelines
|
||||
n.add("Carrier","H2 pipeline")
|
||||
|
||||
n.add("Carrier", "H2 pipeline")
|
||||
|
||||
n.madd(
|
||||
"Link",
|
||||
h2_links.index,
|
||||
@ -252,7 +252,7 @@ if __name__ == "__main__":
|
||||
attach_storageunits(n, costs, elec_config)
|
||||
attach_stores(n, costs, elec_config)
|
||||
attach_hydrogen_pipelines(n, costs, elec_config)
|
||||
|
||||
|
||||
add_missing_carrier(n)
|
||||
|
||||
add_nice_carrier_names(n, snakemake.config)
|
||||
|
@ -714,7 +714,7 @@ def base_network(
|
||||
n.name = "PyPSA-Eur"
|
||||
|
||||
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(lines, "Line")
|
||||
|
@ -22,6 +22,7 @@ from _helpers import (
|
||||
override_component_attrs,
|
||||
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 networkx.algorithms import complement
|
||||
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 scipy.stats import beta
|
||||
from vresutils.costdata import annuity
|
||||
from add_electricity import add_missing_carrier
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -3399,7 +3399,7 @@ if __name__ == "__main__":
|
||||
cluster_heat_buses(n)
|
||||
|
||||
n.meta = dict(snakemake.config, **dict(wildcards=dict(snakemake.wildcards)))
|
||||
|
||||
|
||||
add_missing_carrier(n)
|
||||
|
||||
n.export_to_netcdf(snakemake.output[0])
|
||||
|
Loading…
Reference in New Issue
Block a user