start to extend define_spatial for conventional carriers
This commit is contained in:
parent
08cef37e7e
commit
cfb5a797cb
@ -12,9 +12,11 @@ import xarray as xr
|
|||||||
import pypsa
|
import pypsa
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
from prepare_sector_network import prepare_costs
|
from prepare_sector_network import prepare_costs, define_spatial
|
||||||
from helper import override_component_attrs
|
from helper import override_component_attrs
|
||||||
|
|
||||||
|
from types import SimpleNamespace
|
||||||
|
spatial = SimpleNamespace()
|
||||||
|
|
||||||
def add_build_year_to_new_assets(n, baseyear):
|
def add_build_year_to_new_assets(n, baseyear):
|
||||||
"""
|
"""
|
||||||
@ -473,7 +475,8 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
overrides = override_component_attrs(snakemake.input.overrides)
|
overrides = override_component_attrs(snakemake.input.overrides)
|
||||||
n = pypsa.Network(snakemake.input.network, override_component_attrs=overrides)
|
n = pypsa.Network(snakemake.input.network, override_component_attrs=overrides)
|
||||||
|
# define spatial resolution of carriers
|
||||||
|
define_spatial(n.buses[n.buses.carrier=="AC"].index, options)
|
||||||
add_build_year_to_new_assets(n, baseyear)
|
add_build_year_to_new_assets(n, baseyear)
|
||||||
|
|
||||||
Nyears = n.snapshot_weightings.generators.sum() / 8760.
|
Nyears = n.snapshot_weightings.generators.sum() / 8760.
|
||||||
|
@ -28,7 +28,7 @@ from types import SimpleNamespace
|
|||||||
spatial = SimpleNamespace()
|
spatial = SimpleNamespace()
|
||||||
|
|
||||||
|
|
||||||
def define_spatial(nodes):
|
def define_spatial(nodes, options):
|
||||||
"""
|
"""
|
||||||
Namespace for spatial
|
Namespace for spatial
|
||||||
|
|
||||||
@ -38,7 +38,6 @@ def define_spatial(nodes):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
global spatial
|
global spatial
|
||||||
global options
|
|
||||||
|
|
||||||
spatial.nodes = nodes
|
spatial.nodes = nodes
|
||||||
|
|
||||||
@ -95,6 +94,26 @@ def define_spatial(nodes):
|
|||||||
|
|
||||||
spatial.gas.df = pd.DataFrame(vars(spatial.gas), index=nodes)
|
spatial.gas.df = pd.DataFrame(vars(spatial.gas), index=nodes)
|
||||||
|
|
||||||
|
# oil
|
||||||
|
spatial.oil = SimpleNamespace()
|
||||||
|
spatial.oil.nodes = ["EU oil"]
|
||||||
|
spatial.oil.locations = ["EU"]
|
||||||
|
|
||||||
|
# uranium
|
||||||
|
spatial.uranium = SimpleNamespace()
|
||||||
|
spatial.uranium.nodes = ["EU uranium"]
|
||||||
|
spatial.uranium.locations = ["EU"]
|
||||||
|
|
||||||
|
# coal
|
||||||
|
spatial.coal = SimpleNamespace()
|
||||||
|
spatial.coal.nodes = ["EU coal"]
|
||||||
|
spatial.coal.locations = ["EU"]
|
||||||
|
|
||||||
|
# lignite
|
||||||
|
spatial.lignite = SimpleNamespace()
|
||||||
|
spatial.lignite.nodes = ["EU lignite"]
|
||||||
|
spatial.lignite.locations = ["EU"]
|
||||||
|
|
||||||
|
|
||||||
from types import SimpleNamespace
|
from types import SimpleNamespace
|
||||||
spatial = SimpleNamespace()
|
spatial = SimpleNamespace()
|
||||||
@ -2438,7 +2457,7 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
patch_electricity_network(n)
|
patch_electricity_network(n)
|
||||||
|
|
||||||
define_spatial(pop_layout.index)
|
define_spatial(pop_layout.index, options)
|
||||||
|
|
||||||
if snakemake.config["foresight"] == 'myopic':
|
if snakemake.config["foresight"] == 'myopic':
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user