Merge branch 'master' into configs-in-one-folder

This commit is contained in:
Fabian 2023-04-21 10:26:45 +02:00
commit e40011cb3c
53 changed files with 54 additions and 79 deletions

View File

@ -39,7 +39,7 @@ repos:
# Make docstrings PEP 257 compliant # Make docstrings PEP 257 compliant
- repo: https://github.com/PyCQA/docformatter - repo: https://github.com/PyCQA/docformatter
rev: v1.6.0 rev: v1.6.1-rc1
hooks: hooks:
- id: docformatter - id: docformatter
args: ["--in-place", "--make-summary-multi-line", "--pre-summary-newline"] args: ["--in-place", "--make-summary-multi-line", "--pre-summary-newline"]

View File

@ -464,7 +464,7 @@ sector:
solar_cf_correction: 0.788457 # = >>> 1/1.2683 solar_cf_correction: 0.788457 # = >>> 1/1.2683
marginal_cost_storage: 0. #1e-4 marginal_cost_storage: 0. #1e-4
methanation: true methanation: true
helmeth: true helmeth: false
coal_cc: false coal_cc: false
dac: true dac: true
co2_vent: false co2_vent: false

View File

@ -86,13 +86,13 @@ Rule ``build_powerplants``
.. automodule:: build_powerplants .. automodule:: build_powerplants
.. _load_data: .. _electricity_demand:
Rule ``build_load_data`` Rule ``build_electricity_demand``
============================= =============================
.. automodule:: build_load_data .. automodule:: build_electricity_demand
.. _ship: .. _ship:

View File

@ -12,6 +12,8 @@ Upcoming Release
* Bugfix: Correct typo in the CPLEX solver configuration in ``config.default.yaml``. * Bugfix: Correct typo in the CPLEX solver configuration in ``config.default.yaml``.
* Renamed script file from PyPSA-EUR ``build_load_data`` to ``build_electricity_demand``.
PyPSA-Eur 0.8.0 (18th March 2023) PyPSA-Eur 0.8.0 (18th March 2023)
================================= =================================
@ -558,7 +560,7 @@ More OPSD integration:
This will overwrite the capacities calculated from the heuristic approach in :func:`estimate_renewable_capacities()` This will overwrite the capacities calculated from the heuristic approach in :func:`estimate_renewable_capacities()`
[`#212 <https://github.com/PyPSA/pypsa-eur/pull/212>`_]. [`#212 <https://github.com/PyPSA/pypsa-eur/pull/212>`_].
* Electricity consumption data is now retrieved directly from the `OPSD website <https://data.open-power-system-data.org/time_series/2019-06-05>`_ using the rule :mod:`build_load_data`. * Electricity consumption data is now retrieved directly from the `OPSD website <https://data.open-power-system-data.org/time_series/2019-06-05>`_ using the rule :mod:`build_electricity_demand`.
The user can decide whether to take the ENTSO-E power statistics data (default) or the ENTSO-E transparency data The user can decide whether to take the ENTSO-E power statistics data (default) or the ENTSO-E transparency data
[`#211 <https://github.com/PyPSA/pypsa-eur/pull/211>`_]. [`#211 <https://github.com/PyPSA/pypsa-eur/pull/211>`_].

View File

@ -155,7 +155,7 @@ This triggers a workflow of multiple preceding jobs that depend on each rule's i
19[label = "build_hydro_profile", color = "0.44 0.6 0.85", style="rounded"]; 19[label = "build_hydro_profile", color = "0.44 0.6 0.85", style="rounded"];
20[label = "retrieve_cost_data", color = "0.30 0.6 0.85", style="rounded"]; 20[label = "retrieve_cost_data", color = "0.30 0.6 0.85", style="rounded"];
21[label = "build_powerplants", color = "0.16 0.6 0.85", style="rounded"]; 21[label = "build_powerplants", color = "0.16 0.6 0.85", style="rounded"];
22[label = "build_load_data", color = "0.00 0.6 0.85", style="rounded"]; 22[label = "build_electricity_demand", color = "0.00 0.6 0.85", style="rounded"];
23[label = "retrieve_load_data", color = "0.34 0.6 0.85", style="rounded,dashed"]; 23[label = "retrieve_load_data", color = "0.34 0.6 0.85", style="rounded,dashed"];
1 -> 0 1 -> 0
2 -> 1 2 -> 1
@ -232,7 +232,7 @@ In the terminal, this will show up as a list of jobs to be run:
base_network 1 1 1 base_network 1 1 1
build_bus_regions 1 1 1 build_bus_regions 1 1 1
build_hydro_profile 1 1 1 build_hydro_profile 1 1 1
build_load_data 1 1 1 build_electricity_demand 1 1 1
build_powerplants 1 1 1 build_powerplants 1 1 1
build_renewable_profiles 4 1 1 build_renewable_profiles 4 1 1
build_shapes 1 1 1 build_shapes 1 1 1

View File

@ -140,7 +140,7 @@ successfully.
18[label = "retrieve_ship_raster", color = "0.15 0.6 0.85", style="rounded"]; 18[label = "retrieve_ship_raster", color = "0.15 0.6 0.85", style="rounded"];
19[label = "retrieve_cost_data", color = "0.50 0.6 0.85", style="rounded"]; 19[label = "retrieve_cost_data", color = "0.50 0.6 0.85", style="rounded"];
20[label = "build_powerplants", color = "0.49 0.6 0.85", style="rounded"]; 20[label = "build_powerplants", color = "0.49 0.6 0.85", style="rounded"];
21[label = "build_load_data", color = "0.39 0.6 0.85", style="rounded"]; 21[label = "build_electricity_demand", color = "0.39 0.6 0.85", style="rounded"];
22[label = "retrieve_load_data", color = "0.05 0.6 0.85", style="rounded"]; 22[label = "retrieve_load_data", color = "0.05 0.6 0.85", style="rounded"];
23[label = "build_gas_input_locations", color = "0.45 0.6 0.85", style="rounded"]; 23[label = "build_gas_input_locations", color = "0.45 0.6 0.85", style="rounded"];
24[label = "prepare_network", color = "0.31 0.6 0.85", style="rounded"]; 24[label = "prepare_network", color = "0.31 0.6 0.85", style="rounded"];
@ -367,7 +367,7 @@ implemented in the workflow:
18[label = "retrieve_ship_raster", color = "0.09 0.6 0.85", style="rounded"]; 18[label = "retrieve_ship_raster", color = "0.09 0.6 0.85", style="rounded"];
19[label = "retrieve_cost_data", color = "0.04 0.6 0.85", style="rounded"]; 19[label = "retrieve_cost_data", color = "0.04 0.6 0.85", style="rounded"];
20[label = "build_powerplants", color = "0.28 0.6 0.85", style="rounded"]; 20[label = "build_powerplants", color = "0.28 0.6 0.85", style="rounded"];
21[label = "build_load_data", color = "0.46 0.6 0.85", style="rounded"]; 21[label = "build_electricity_demand", color = "0.46 0.6 0.85", style="rounded"];
22[label = "retrieve_load_data", color = "0.44 0.6 0.85", style="rounded"]; 22[label = "retrieve_load_data", color = "0.44 0.6 0.85", style="rounded"];
23[label = "build_energy_totals", color = "0.53 0.6 0.85", style="rounded"]; 23[label = "build_energy_totals", color = "0.53 0.6 0.85", style="rounded"];
24[label = "build_population_weighted_energy_totals", color = "0.03 0.6 0.85", style="rounded"]; 24[label = "build_population_weighted_energy_totals", color = "0.03 0.6 0.85", style="rounded"];

View File

@ -287,11 +287,14 @@ dependencies:
- qt-main=5.15.8 - qt-main=5.15.8
- rasterio=1.3.4 - rasterio=1.3.4
- readline=8.1.2 - readline=8.1.2
- requests=2.28.2 - requests=2.28.1
- reretry=0.11.8 - retry=0.9.2
- rtree=1.0.1 - rich=12.5.1
- scikit-learn=1.2.1 - rioxarray=0.13.3
- scipy=1.10.0 - rtree=1.0.0
- s2n=1.0.10
- scikit-learn=1.1.1
- scipy=1.8.1
- scotch=6.0.9 - scotch=6.0.9
- seaborn=0.12.2 - seaborn=0.12.2
- seaborn-base=0.12.2 - seaborn-base=0.12.2

View File

@ -29,6 +29,7 @@ dependencies:
- pandas>=1.4 - pandas>=1.4
- geopandas>=0.11.0 - geopandas>=0.11.0
- xarray - xarray
- rioxarray
- netcdf4 - netcdf4
- networkx - networkx
- scipy - scipy

View File

@ -18,19 +18,19 @@ if config["enable"].get("prepare_links_p_nom", False):
"../scripts/prepare_links_p_nom.py" "../scripts/prepare_links_p_nom.py"
rule build_load_data: rule build_electricity_demand:
input: input:
ancient("data/load_raw.csv"), ancient("data/load_raw.csv"),
output: output:
RESOURCES + "load.csv", RESOURCES + "load.csv",
log: log:
LOGS + "build_load_data.log", LOGS + "build_electricity_demand.log",
resources: resources:
mem_mb=5000, mem_mb=5000,
conda: conda:
"../envs/environment.yaml" "../envs/environment.yaml"
script: script:
"../scripts/build_load_data.py" "../scripts/build_electricity_demand.py"
rule build_powerplants: rule build_powerplants:
@ -172,7 +172,7 @@ rule build_ship_raster:
], ],
), ),
output: output:
RESOURCES + "shipdensity_raster.nc", RESOURCES + "shipdensity_raster.tif",
log: log:
LOGS + "build_ship_raster.log", LOGS + "build_ship_raster.log",
resources: resources:
@ -202,7 +202,7 @@ rule build_renewable_profiles:
) )
), ),
ship_density=lambda w: ( ship_density=lambda w: (
RESOURCES + "shipdensity_raster.nc" RESOURCES + "shipdensity_raster.tif"
if "ship_threshold" in config["renewable"][w.technology].keys() if "ship_threshold" in config["renewable"][w.technology].keys()
else [] else []
), ),

View File

@ -2,7 +2,6 @@
# SPDX-FileCopyrightText: : 2020-2023 The PyPSA-Eur Authors # SPDX-FileCopyrightText: : 2020-2023 The PyPSA-Eur Authors
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
""" """
Prepares brownfield data from previous planning horizon. Prepares brownfield data from previous planning horizon.
""" """

View File

@ -2,7 +2,6 @@
# SPDX-FileCopyrightText: : 2020-2023 The PyPSA-Eur Authors # SPDX-FileCopyrightText: : 2020-2023 The PyPSA-Eur Authors
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
""" """
Adds existing power and heat generation capacities for initial planning Adds existing power and heat generation capacities for initial planning
horizon. horizon.

View File

@ -197,7 +197,7 @@ def convert_nuts2_to_regions(bio_nuts2, regions):
) )
overlay[adjust_cols] = overlay[adjust_cols].multiply(overlay["share"], axis=0) overlay[adjust_cols] = overlay[adjust_cols].multiply(overlay["share"], axis=0)
bio_regions = overlay.groupby("name").sum() bio_regions = overlay.dissolve("name", aggfunc="sum")
bio_regions.drop(["area_nuts2", "share"], axis=1, inplace=True) bio_regions.drop(["area_nuts2", "share"], axis=1, inplace=True)

View File

@ -2,7 +2,6 @@
# SPDX-FileCopyrightText: : 2020-2023 The PyPSA-Eur Authors # SPDX-FileCopyrightText: : 2020-2023 The PyPSA-Eur Authors
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
""" """
Reads biomass transport costs for different countries of the JRC report. Reads biomass transport costs for different countries of the JRC report.

View File

@ -2,7 +2,6 @@
# SPDX-FileCopyrightText: : 2017-2023 The PyPSA-Eur Authors # SPDX-FileCopyrightText: : 2017-2023 The PyPSA-Eur Authors
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
""" """
Creates Voronoi shapes for each bus representing both onshore and offshore Creates Voronoi shapes for each bus representing both onshore and offshore
regions. regions.

View File

@ -2,7 +2,6 @@
# SPDX-FileCopyrightText: : 2020-2023 The PyPSA-Eur Authors # SPDX-FileCopyrightText: : 2020-2023 The PyPSA-Eur Authors
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
""" """
Build population layouts for all clustered model regions as total as well as Build population layouts for all clustered model regions as total as well as
split by urban and rural population. split by urban and rural population.

View File

@ -2,7 +2,6 @@
# SPDX-FileCopyrightText: : 2020-2023 The PyPSA-Eur Authors # SPDX-FileCopyrightText: : 2020-2023 The PyPSA-Eur Authors
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
""" """
Build coefficient of performance (COP) time series for air- or ground-sourced Build coefficient of performance (COP) time series for air- or ground-sourced
heat pumps. heat pumps.

View File

@ -2,7 +2,6 @@
# SPDX-FileCopyrightText: : 2017-2023 The PyPSA-Eur Authors # SPDX-FileCopyrightText: : 2017-2023 The PyPSA-Eur Authors
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
""" """
Create cutouts with `atlite <https://atlite.readthedocs.io/en/latest/>`_. Create cutouts with `atlite <https://atlite.readthedocs.io/en/latest/>`_.

View File

@ -2,7 +2,6 @@
# SPDX-FileCopyrightText: : 2020 @JanFrederickUnnewehr, The PyPSA-Eur Authors # SPDX-FileCopyrightText: : 2020 @JanFrederickUnnewehr, The PyPSA-Eur Authors
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
""" """
This rule downloads the load data from `Open Power System Data Time series. This rule downloads the load data from `Open Power System Data Time series.
@ -276,7 +275,7 @@ if __name__ == "__main__":
if "snakemake" not in globals(): if "snakemake" not in globals():
from _helpers import mock_snakemake from _helpers import mock_snakemake
snakemake = mock_snakemake("build_load_data") snakemake = mock_snakemake("build_electricity_demand")
configure_logging(snakemake) configure_logging(snakemake)

View File

@ -2,7 +2,6 @@
# SPDX-FileCopyrightText: : 2020-2023 The PyPSA-Eur Authors # SPDX-FileCopyrightText: : 2020-2023 The PyPSA-Eur Authors
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
""" """
Build total energy demands per country using JRC IDEES, eurostat, and EEA data. Build total energy demands per country using JRC IDEES, eurostat, and EEA data.
""" """

View File

@ -2,7 +2,6 @@
# SPDX-FileCopyrightText: : 2021-2023 The PyPSA-Eur Authors # SPDX-FileCopyrightText: : 2021-2023 The PyPSA-Eur Authors
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
""" """
Build import locations for fossil gas from entry-points, LNG terminals and Build import locations for fossil gas from entry-points, LNG terminals and
production sites with data from SciGRID_gas and Global Energy Monitor. production sites with data from SciGRID_gas and Global Energy Monitor.

View File

@ -2,7 +2,6 @@
# SPDX-FileCopyrightText: : 2020-2023 The PyPSA-Eur Authors # SPDX-FileCopyrightText: : 2020-2023 The PyPSA-Eur Authors
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
""" """
Preprocess gas network based on data from bthe SciGRID_gas project Preprocess gas network based on data from bthe SciGRID_gas project
(https://www.gas.scigrid.de/). (https://www.gas.scigrid.de/).

View File

@ -2,7 +2,6 @@
# SPDX-FileCopyrightText: : 2020-2023 The PyPSA-Eur Authors # SPDX-FileCopyrightText: : 2020-2023 The PyPSA-Eur Authors
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
""" """
Build heat demand time series using heating degree day (HDD) approximation. Build heat demand time series using heating degree day (HDD) approximation.
""" """

View File

@ -4,7 +4,6 @@
# SPDX-FileCopyrightText: : 2017-2023 The PyPSA-Eur Authors # SPDX-FileCopyrightText: : 2017-2023 The PyPSA-Eur Authors
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
""" """
Build hydroelectric inflow time-series for each country. Build hydroelectric inflow time-series for each country.

View File

@ -2,7 +2,6 @@
# SPDX-FileCopyrightText: : 2020-2023 The PyPSA-Eur Authors # SPDX-FileCopyrightText: : 2020-2023 The PyPSA-Eur Authors
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
""" """
Build spatial distribution of industries from Hotmaps database. Build spatial distribution of industries from Hotmaps database.
""" """

View File

@ -2,7 +2,6 @@
# SPDX-FileCopyrightText: : 2020-2023 The PyPSA-Eur Authors # SPDX-FileCopyrightText: : 2020-2023 The PyPSA-Eur Authors
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
""" """
Build industrial energy demand per country. Build industrial energy demand per country.
""" """

View File

@ -2,7 +2,6 @@
# SPDX-FileCopyrightText: : 2020-2023 The PyPSA-Eur Authors # SPDX-FileCopyrightText: : 2020-2023 The PyPSA-Eur Authors
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
""" """
Build industrial energy demand per model region. Build industrial energy demand per model region.
""" """

View File

@ -2,7 +2,6 @@
# SPDX-FileCopyrightText: : 2020-2023 The PyPSA-Eur Authors # SPDX-FileCopyrightText: : 2020-2023 The PyPSA-Eur Authors
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
""" """
Build industrial energy demand per model region. Build industrial energy demand per model region.
""" """

View File

@ -2,7 +2,6 @@
# SPDX-FileCopyrightText: : 2020-2023 The PyPSA-Eur Authors # SPDX-FileCopyrightText: : 2020-2023 The PyPSA-Eur Authors
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
""" """
Build industrial production per country. Build industrial production per country.
""" """

View File

@ -2,7 +2,6 @@
# SPDX-FileCopyrightText: : 2020-2023 The PyPSA-Eur Authors # SPDX-FileCopyrightText: : 2020-2023 The PyPSA-Eur Authors
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
""" """
Build future industrial production per country. Build future industrial production per country.
""" """

View File

@ -2,7 +2,6 @@
# SPDX-FileCopyrightText: : 2020-2023 The PyPSA-Eur Authors # SPDX-FileCopyrightText: : 2020-2023 The PyPSA-Eur Authors
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
""" """
Build industrial production per model region. Build industrial production per model region.
""" """

View File

@ -2,7 +2,6 @@
# SPDX-FileCopyrightText: : 2020-2023 The PyPSA-Eur Authors # SPDX-FileCopyrightText: : 2020-2023 The PyPSA-Eur Authors
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
""" """
Build specific energy consumption by carrier and industries. Build specific energy consumption by carrier and industries.
""" """

View File

@ -2,7 +2,6 @@
# SPDX-FileCopyrightText: : 2017-2023 The PyPSA-Eur Authors # SPDX-FileCopyrightText: : 2017-2023 The PyPSA-Eur Authors
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
""" """
Rasters the vector data of the `Natura 2000. Rasters the vector data of the `Natura 2000.

View File

@ -2,7 +2,6 @@
# SPDX-FileCopyrightText: : 2020-2023 The PyPSA-Eur Authors # SPDX-FileCopyrightText: : 2020-2023 The PyPSA-Eur Authors
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
""" """
Build mapping between cutout grid cells and population (total, urban, rural). Build mapping between cutout grid cells and population (total, urban, rural).
""" """

View File

@ -2,7 +2,6 @@
# SPDX-FileCopyrightText: : 2020-2023 The PyPSA-Eur Authors # SPDX-FileCopyrightText: : 2020-2023 The PyPSA-Eur Authors
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
""" """
Distribute country-level energy demands by population. Distribute country-level energy demands by population.
""" """

View File

@ -4,7 +4,6 @@
# SPDX-FileCopyrightText: : 2017-2023 The PyPSA-Eur Authors # SPDX-FileCopyrightText: : 2017-2023 The PyPSA-Eur Authors
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
""" """
Calculates for each network node the (i) installable capacity (based on land- Calculates for each network node the (i) installable capacity (based on land-
use), (ii) the available generation time series (based on weather data), and use), (ii) the available generation time series (based on weather data), and

View File

@ -3,7 +3,6 @@
# SPDX-FileCopyrightText: : 2020-2023 The PyPSA-Eur Authors # SPDX-FileCopyrightText: : 2020-2023 The PyPSA-Eur Authors
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
""" """
This script calculates the space heating savings through better insulation of This script calculates the space heating savings through better insulation of
the thermal envelope of a building and corresponding costs for different the thermal envelope of a building and corresponding costs for different

View File

@ -2,7 +2,6 @@
# SPDX-FileCopyrightText: : 2020-2023 The PyPSA-Eur Authors # SPDX-FileCopyrightText: : 2020-2023 The PyPSA-Eur Authors
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
""" """
Build salt cavern potentials for hydrogen storage. Build salt cavern potentials for hydrogen storage.

View File

@ -2,7 +2,6 @@
# SPDX-FileCopyrightText: : 2023 The PyPSA-Eur Authors # SPDX-FileCopyrightText: : 2023 The PyPSA-Eur Authors
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
""" """
Build regionalised geological sequestration potential for carbon dioxide using Build regionalised geological sequestration potential for carbon dioxide using
data from `CO2Stop <https://setis.ec.europa.eu/european-co2-storage- data from `CO2Stop <https://setis.ec.europa.eu/european-co2-storage-

View File

@ -2,7 +2,6 @@
# SPDX-FileCopyrightText: : 2017-2023 The PyPSA-Eur Authors # SPDX-FileCopyrightText: : 2017-2023 The PyPSA-Eur Authors
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
""" """
Creates GIS shape files of the countries, exclusive economic zones and `NUTS3 < Creates GIS shape files of the countries, exclusive economic zones and `NUTS3 <
https://en.wikipedia.org/wiki/Nomenclature_of_Territorial_Units_for_Statistics> https://en.wikipedia.org/wiki/Nomenclature_of_Territorial_Units_for_Statistics>

View File

@ -2,7 +2,6 @@
# SPDX-FileCopyrightText: : 2022 The PyPSA-Eur Authors # SPDX-FileCopyrightText: : 2022 The PyPSA-Eur Authors
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
""" """
Transforms the global ship density data from the `World Bank Data Catalogue. Transforms the global ship density data from the `World Bank Data Catalogue.
@ -46,7 +45,7 @@ import logging
import os import os
import zipfile import zipfile
import xarray as xr import rioxarray
from _helpers import configure_logging from _helpers import configure_logging
from build_natura_raster import determine_cutout_xXyY from build_natura_raster import determine_cutout_xXyY
@ -64,10 +63,10 @@ if __name__ == "__main__":
with zipfile.ZipFile(snakemake.input.ship_density) as zip_f: with zipfile.ZipFile(snakemake.input.ship_density) as zip_f:
zip_f.extract("shipdensity_global.tif") zip_f.extract("shipdensity_global.tif")
with xr.open_rasterio("shipdensity_global.tif") as ship_density: with rioxarray.open_rasterio("shipdensity_global.tif") as ship_density:
ship_density = ship_density.drop(["band"]).sel( ship_density = ship_density.drop(["band"]).sel(
x=slice(min(xs), max(Xs)), y=slice(max(Ys), min(ys)) x=slice(min(xs), max(Xs)), y=slice(max(Ys), min(ys))
) )
ship_density.to_netcdf(snakemake.output[0]) ship_density.rio.to_raster(snakemake.output[0])
os.remove("shipdensity_global.tif") os.remove("shipdensity_global.tif")

View File

@ -2,7 +2,6 @@
# SPDX-FileCopyrightText: : 2020-2023 The PyPSA-Eur Authors # SPDX-FileCopyrightText: : 2020-2023 The PyPSA-Eur Authors
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
""" """
Build solar thermal collector time series. Build solar thermal collector time series.
""" """

View File

@ -2,7 +2,6 @@
# SPDX-FileCopyrightText: : 2020-2023 The PyPSA-Eur Authors # SPDX-FileCopyrightText: : 2020-2023 The PyPSA-Eur Authors
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
""" """
Build time series for air and soil temperatures per clustered model region. Build time series for air and soil temperatures per clustered model region.
""" """

View File

@ -2,7 +2,6 @@
# SPDX-FileCopyrightText: : 2020-2023 The PyPSA-Eur Authors # SPDX-FileCopyrightText: : 2020-2023 The PyPSA-Eur Authors
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
""" """
Build land transport demand per clustered model region including efficiency Build land transport demand per clustered model region including efficiency
improvements due to drivetrain changes, time series for electric vehicle improvements due to drivetrain changes, time series for electric vehicle

View File

@ -2,7 +2,6 @@
# SPDX-FileCopyrightText: : 2020-2023 The PyPSA-Eur Authors # SPDX-FileCopyrightText: : 2020-2023 The PyPSA-Eur Authors
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
""" """
Cluster gas transmission network to clustered model regions. Cluster gas transmission network to clustered model regions.
""" """

View File

@ -2,7 +2,6 @@
# SPDX-FileCopyrightText: : 2020-2023 The PyPSA-Eur Authors # SPDX-FileCopyrightText: : 2020-2023 The PyPSA-Eur Authors
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
""" """
Copy used configuration files and important scripts for archiving. Copy used configuration files and important scripts for archiving.
""" """

View File

@ -2,7 +2,6 @@
# SPDX-FileCopyrightText: : 2020-2023 The PyPSA-Eur Authors # SPDX-FileCopyrightText: : 2020-2023 The PyPSA-Eur Authors
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
""" """
Create summary CSV files for all scenario runs including costs, capacities, Create summary CSV files for all scenario runs including costs, capacities,
capacity factors, curtailment, energy balances, prices and other metrics. capacity factors, curtailment, energy balances, prices and other metrics.

View File

@ -2,7 +2,6 @@
# SPDX-FileCopyrightText: : 2020-2023 The PyPSA-Eur Authors # SPDX-FileCopyrightText: : 2020-2023 The PyPSA-Eur Authors
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
""" """
Creates plots for optimised network topologies, including electricity, gas and Creates plots for optimised network topologies, including electricity, gas and
hydrogen networks, and regional generation, storage and conversion capacities hydrogen networks, and regional generation, storage and conversion capacities

View File

@ -2,7 +2,6 @@
# SPDX-FileCopyrightText: : 2020-2023 The PyPSA-Eur Authors # SPDX-FileCopyrightText: : 2020-2023 The PyPSA-Eur Authors
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
""" """
Creates plots from summary CSV files. Creates plots from summary CSV files.
""" """

View File

@ -4,7 +4,6 @@
# SPDX-FileCopyrightText: : 2017-2023 The PyPSA-Eur Authors # SPDX-FileCopyrightText: : 2017-2023 The PyPSA-Eur Authors
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
""" """
Extracts capacities of HVDC links from `Wikipedia. Extracts capacities of HVDC links from `Wikipedia.

View File

@ -2,7 +2,6 @@
# SPDX-FileCopyrightText: : 2020-2023 The PyPSA-Eur Authors # SPDX-FileCopyrightText: : 2020-2023 The PyPSA-Eur Authors
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
""" """
Adds all sector-coupling components to the network, including demand and supply Adds all sector-coupling components to the network, including demand and supply
technologies for the buildings, transport and industry sectors. technologies for the buildings, transport and industry sectors.

View File

@ -3,7 +3,6 @@
# SPDX-FileCopyrightText: : 2017-2023 The PyPSA-Eur Authors # SPDX-FileCopyrightText: : 2017-2023 The PyPSA-Eur Authors
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
""" """
.. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.3517935.svg .. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.3517935.svg
:target: https://doi.org/10.5281/zenodo.3517935 :target: https://doi.org/10.5281/zenodo.3517935

View File

@ -2,7 +2,6 @@
# SPDX-FileCopyrightText: : 2017-2023 The PyPSA-Eur Authors # SPDX-FileCopyrightText: : 2017-2023 The PyPSA-Eur Authors
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
""" """
Solves optimal operation and capacity for a network with the option to Solves optimal operation and capacity for a network with the option to
iteratively optimize while updating line reactances. iteratively optimize while updating line reactances.
@ -43,6 +42,7 @@ from vresutils.benchmark import memory_logger
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
pypsa.pf.logger.setLevel(logging.WARNING) pypsa.pf.logger.setLevel(logging.WARNING)
from pypsa.descriptors import get_switchable_as_dense as get_as_dense
def add_land_use_constraint(n, config): def add_land_use_constraint(n, config):
@ -414,7 +414,7 @@ def add_operational_reserve_margin(n, sns, config):
0, np.inf, coords=[sns, n.generators.index], name="Generator-r" 0, np.inf, coords=[sns, n.generators.index], name="Generator-r"
) )
reserve = n.model["Generator-r"] reserve = n.model["Generator-r"]
lhs = reserve.sum("Generator") summed_reserve = reserve.sum("Generator")
# Share of extendable renewable capacities # Share of extendable renewable capacities
ext_i = n.generators.query("p_nom_extendable").index ext_i = n.generators.query("p_nom_extendable").index
@ -426,10 +426,12 @@ def add_operational_reserve_margin(n, sns, config):
.loc[vres_i.intersection(ext_i)] .loc[vres_i.intersection(ext_i)]
.rename({"Generator-ext": "Generator"}) .rename({"Generator-ext": "Generator"})
) )
lhs = lhs + (p_nom_vres * (-EPSILON_VRES * capacity_factor)).sum() lhs = summed_reserve + (p_nom_vres * (-EPSILON_VRES * capacity_factor)).sum(
"Generator"
)
# Total demand per t # Total demand per t
demand = n.loads_t.p_set.sum(axis=1) demand = get_as_dense(n, "Load", "p_set").sum(axis=1)
# VRES potential of non extendable generators # VRES potential of non extendable generators
capacity_factor = n.generators_t.p_max_pu[vres_i.difference(ext_i)] capacity_factor = n.generators_t.p_max_pu[vres_i.difference(ext_i)]
@ -441,17 +443,26 @@ def add_operational_reserve_margin(n, sns, config):
n.model.add_constraints(lhs >= rhs, name="reserve_margin") n.model.add_constraints(lhs >= rhs, name="reserve_margin")
# additional constraint that capacity is not exceeded
gen_i = n.generators.index
ext_i = n.generators.query("p_nom_extendable").index
fix_i = n.generators.query("not p_nom_extendable").index
dispatch = n.model["Generator-p"]
reserve = n.model["Generator-r"] reserve = n.model["Generator-r"]
lhs = n.model.constraints["Generator-fix-p-upper"].lhs capacity_variable = n.model["Generator-p_nom"].rename(
lhs = lhs + reserve.loc[:, lhs.coords["Generator-fix"]].drop("Generator") {"Generator-ext": "Generator"}
rhs = n.model.constraints["Generator-fix-p-upper"].rhs )
n.model.add_constraints(lhs <= rhs, name="Generator-fix-p-upper-reserve") capacity_fixed = n.generators.p_nom[fix_i]
lhs = n.model.constraints["Generator-ext-p-upper"].lhs p_max_pu = get_as_dense(n, "Generator", "p_max_pu")
lhs = lhs + reserve.loc[:, lhs.coords["Generator-ext"]].drop("Generator")
rhs = n.model.constraints["Generator-ext-p-upper"].rhs lhs = dispatch + reserve - capacity_variable * p_max_pu[ext_i]
n.model.add_constraints(lhs >= rhs, name="Generator-ext-p-upper-reserve")
rhs = (p_max_pu[fix_i] * capacity_fixed).reindex(columns=gen_i, fill_value=0)
n.model.add_constraints(lhs <= rhs, name="Generator-p-reserve-upper")
def add_battery_constraints(n): def add_battery_constraints(n):

View File

@ -2,7 +2,6 @@
# SPDX-FileCopyrightText: : 2017-2023 The PyPSA-Eur Authors # SPDX-FileCopyrightText: : 2017-2023 The PyPSA-Eur Authors
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
""" """
Solves linear optimal dispatch in hourly resolution using the capacities of Solves linear optimal dispatch in hourly resolution using the capacities of
previous capacity expansion in rule :mod:`solve_network`. previous capacity expansion in rule :mod:`solve_network`.