Merge branch 'master' into improve-build-profiles-logging

This commit is contained in:
Fabian Neumann 2024-01-03 13:24:23 +01:00 committed by GitHub
commit 8e158d45a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 42 additions and 63 deletions

View File

@ -167,7 +167,6 @@ renewable:
distance_grid_codes: [1, 2, 3, 4, 5, 6] distance_grid_codes: [1, 2, 3, 4, 5, 6]
natura: true natura: true
excluder_resolution: 100 excluder_resolution: 100
potential: simple # or conservative
clip_p_max_pu: 1.e-2 clip_p_max_pu: 1.e-2
offwind-ac: offwind-ac:
cutout: europe-2013-era5 cutout: europe-2013-era5
@ -183,7 +182,6 @@ renewable:
max_depth: 50 max_depth: 50
max_shore_distance: 30000 max_shore_distance: 30000
excluder_resolution: 200 excluder_resolution: 200
potential: simple # or conservative
clip_p_max_pu: 1.e-2 clip_p_max_pu: 1.e-2
offwind-dc: offwind-dc:
cutout: europe-2013-era5 cutout: europe-2013-era5
@ -199,7 +197,6 @@ renewable:
max_depth: 50 max_depth: 50
min_shore_distance: 30000 min_shore_distance: 30000
excluder_resolution: 200 excluder_resolution: 200
potential: simple # or conservative
clip_p_max_pu: 1.e-2 clip_p_max_pu: 1.e-2
solar: solar:
cutout: europe-2013-sarah cutout: europe-2013-sarah
@ -214,7 +211,6 @@ renewable:
corine: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 26, 31, 32] corine: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 26, 31, 32]
natura: true natura: true
excluder_resolution: 100 excluder_resolution: 100
potential: simple # or conservative
clip_p_max_pu: 1.e-2 clip_p_max_pu: 1.e-2
hydro: hydro:
cutout: europe-2013-era5 cutout: europe-2013-era5
@ -885,6 +881,7 @@ plotting:
# heat demand # heat demand
Heat load: '#cc1f1f' Heat load: '#cc1f1f'
heat: '#cc1f1f' heat: '#cc1f1f'
heat vent: '#aa3344'
heat demand: '#cc1f1f' heat demand: '#cc1f1f'
rural heat: '#ff5c5c' rural heat: '#ff5c5c'
residential rural heat: '#ff7c7c' residential rural heat: '#ff7c7c'

View File

@ -12,5 +12,4 @@ ship_threshold,--,float,"Ship density threshold from which areas are excluded."
max_depth,m,float,"Maximum sea water depth at which wind turbines can be build. Maritime areas with deeper waters are excluded in the process of calculating the AC-connected offshore wind potential." max_depth,m,float,"Maximum sea water depth at which wind turbines can be build. Maritime areas with deeper waters are excluded in the process of calculating the AC-connected offshore wind potential."
min_shore_distance,m,float,"Minimum distance to the shore below which wind turbines cannot be build. Such areas close to the shore are excluded in the process of calculating the AC-connected offshore wind potential." min_shore_distance,m,float,"Minimum distance to the shore below which wind turbines cannot be build. Such areas close to the shore are excluded in the process of calculating the AC-connected offshore wind potential."
max_shore_distance,m,float,"Maximum distance to the shore above which wind turbines cannot be build. Such areas close to the shore are excluded in the process of calculating the AC-connected offshore wind potential." max_shore_distance,m,float,"Maximum distance to the shore above which wind turbines cannot be build. Such areas close to the shore are excluded in the process of calculating the AC-connected offshore wind potential."
potential,--,"One of {'simple', 'conservative'}","Method to compute the maximal installable potential for a node; confer :ref:`renewableprofiles`"
clip_p_max_pu,p.u.,float,"To avoid too small values in the renewables` per-unit availability time series values below this threshold are set to zero." clip_p_max_pu,p.u.,float,"To avoid too small values in the renewables` per-unit availability time series values below this threshold are set to zero."

1 Unit Values Description
12 max_depth m float Maximum sea water depth at which wind turbines can be build. Maritime areas with deeper waters are excluded in the process of calculating the AC-connected offshore wind potential.
13 min_shore_distance m float Minimum distance to the shore below which wind turbines cannot be build. Such areas close to the shore are excluded in the process of calculating the AC-connected offshore wind potential.
14 max_shore_distance m float Maximum distance to the shore above which wind turbines cannot be build. Such areas close to the shore are excluded in the process of calculating the AC-connected offshore wind potential.
potential -- One of {'simple', 'conservative'} Method to compute the maximal installable potential for a node; confer :ref:`renewableprofiles`
15 clip_p_max_pu p.u. float To avoid too small values in the renewables` per-unit availability time series values below this threshold are set to zero.

View File

@ -12,5 +12,4 @@ ship_threshold,--,float,"Ship density threshold from which areas are excluded."
max_depth,m,float,"Maximum sea water depth at which wind turbines can be build. Maritime areas with deeper waters are excluded in the process of calculating the AC-connected offshore wind potential." max_depth,m,float,"Maximum sea water depth at which wind turbines can be build. Maritime areas with deeper waters are excluded in the process of calculating the AC-connected offshore wind potential."
min_shore_distance,m,float,"Minimum distance to the shore below which wind turbines cannot be build." min_shore_distance,m,float,"Minimum distance to the shore below which wind turbines cannot be build."
max_shore_distance,m,float,"Maximum distance to the shore above which wind turbines cannot be build." max_shore_distance,m,float,"Maximum distance to the shore above which wind turbines cannot be build."
potential,--,"One of {'simple', 'conservative'}","Method to compute the maximal installable potential for a node; confer :ref:`renewableprofiles`"
clip_p_max_pu,p.u.,float,"To avoid too small values in the renewables` per-unit availability time series values below this threshold are set to zero." clip_p_max_pu,p.u.,float,"To avoid too small values in the renewables` per-unit availability time series values below this threshold are set to zero."

1 Unit Values Description
12 max_depth m float Maximum sea water depth at which wind turbines can be build. Maritime areas with deeper waters are excluded in the process of calculating the AC-connected offshore wind potential.
13 min_shore_distance m float Minimum distance to the shore below which wind turbines cannot be build.
14 max_shore_distance m float Maximum distance to the shore above which wind turbines cannot be build.
potential -- One of {'simple', 'conservative'} Method to compute the maximal installable potential for a node; confer :ref:`renewableprofiles`
15 clip_p_max_pu p.u. float To avoid too small values in the renewables` per-unit availability time series values below this threshold are set to zero.

View File

@ -9,7 +9,6 @@ corine,,,
-- distance,m,float,"Distance to keep from areas specified in ``distance_grid_codes``" -- distance,m,float,"Distance to keep from areas specified in ``distance_grid_codes``"
-- distance_grid_codes,--,"Any subset of the `CORINE Land Cover code list <http://www.eea.europa.eu/data-and-maps/data/corine-land-cover-2006-raster-1/corine-land-cover-classes-and/clc_legend.csv/at_download/file>`_","Specifies areas according to CORINE Land Cover codes to which wind turbines must maintain a distance specified in the setting ``distance``." -- distance_grid_codes,--,"Any subset of the `CORINE Land Cover code list <http://www.eea.europa.eu/data-and-maps/data/corine-land-cover-2006-raster-1/corine-land-cover-classes-and/clc_legend.csv/at_download/file>`_","Specifies areas according to CORINE Land Cover codes to which wind turbines must maintain a distance specified in the setting ``distance``."
natura,bool,"{true, false}","Switch to exclude `Natura 2000 <https://en.wikipedia.org/wiki/Natura_2000>`_ natural protection areas. Area is excluded if ``true``." natura,bool,"{true, false}","Switch to exclude `Natura 2000 <https://en.wikipedia.org/wiki/Natura_2000>`_ natural protection areas. Area is excluded if ``true``."
potential,--,"One of {'simple', 'conservative'}","Method to compute the maximal installable potential for a node; confer :ref:`renewableprofiles`"
clip_p_max_pu,p.u.,float,"To avoid too small values in the renewables` per-unit availability time series values below this threshold are set to zero." clip_p_max_pu,p.u.,float,"To avoid too small values in the renewables` per-unit availability time series values below this threshold are set to zero."
correction_factor,--,float,"Correction factor for capacity factor time series." correction_factor,--,float,"Correction factor for capacity factor time series."
excluder_resolution,m,float,"Resolution on which to perform geographical elibility analysis." excluder_resolution,m,float,"Resolution on which to perform geographical elibility analysis."

1 Unit Values Description
9 -- distance m float Distance to keep from areas specified in ``distance_grid_codes``
10 -- distance_grid_codes -- Any subset of the `CORINE Land Cover code list <http://www.eea.europa.eu/data-and-maps/data/corine-land-cover-2006-raster-1/corine-land-cover-classes-and/clc_legend.csv/at_download/file>`_ Specifies areas according to CORINE Land Cover codes to which wind turbines must maintain a distance specified in the setting ``distance``.
11 natura bool {true, false} Switch to exclude `Natura 2000 <https://en.wikipedia.org/wiki/Natura_2000>`_ natural protection areas. Area is excluded if ``true``.
potential -- One of {'simple', 'conservative'} Method to compute the maximal installable potential for a node; confer :ref:`renewableprofiles`
12 clip_p_max_pu p.u. float To avoid too small values in the renewables` per-unit availability time series values below this threshold are set to zero.
13 correction_factor -- float Correction factor for capacity factor time series.
14 excluder_resolution m float Resolution on which to perform geographical elibility analysis.

View File

@ -10,6 +10,5 @@ capacity_per_sqkm,:math:`MW/km^2`,float,"Allowable density of solar panel placem
correction_factor,--,float,"A correction factor for the capacity factor (availability) time series." correction_factor,--,float,"A correction factor for the capacity factor (availability) time series."
corine,--,"Any subset of the `CORINE Land Cover code list <http://www.eea.europa.eu/data-and-maps/data/corine-land-cover-2006-raster-1/corine-land-cover-classes-and/clc_legend.csv/at_download/file>`_","Specifies areas according to CORINE Land Cover codes which are generally eligible for solar panel placement." corine,--,"Any subset of the `CORINE Land Cover code list <http://www.eea.europa.eu/data-and-maps/data/corine-land-cover-2006-raster-1/corine-land-cover-classes-and/clc_legend.csv/at_download/file>`_","Specifies areas according to CORINE Land Cover codes which are generally eligible for solar panel placement."
natura,bool,"{true, false}","Switch to exclude `Natura 2000 <https://en.wikipedia.org/wiki/Natura_2000>`_ natural protection areas. Area is excluded if ``true``." natura,bool,"{true, false}","Switch to exclude `Natura 2000 <https://en.wikipedia.org/wiki/Natura_2000>`_ natural protection areas. Area is excluded if ``true``."
potential,--,"One of {'simple', 'conservative'}","Method to compute the maximal installable potential for a node; confer :ref:`renewableprofiles`"
clip_p_max_pu,p.u.,float,"To avoid too small values in the renewables` per-unit availability time series values below this threshold are set to zero." clip_p_max_pu,p.u.,float,"To avoid too small values in the renewables` per-unit availability time series values below this threshold are set to zero."
excluder_resolution,m,float,"Resolution on which to perform geographical elibility analysis." excluder_resolution,m,float,"Resolution on which to perform geographical elibility analysis."

1 Unit Values Description
10 correction_factor -- float A correction factor for the capacity factor (availability) time series.
11 corine -- Any subset of the `CORINE Land Cover code list <http://www.eea.europa.eu/data-and-maps/data/corine-land-cover-2006-raster-1/corine-land-cover-classes-and/clc_legend.csv/at_download/file>`_ Specifies areas according to CORINE Land Cover codes which are generally eligible for solar panel placement.
12 natura bool {true, false} Switch to exclude `Natura 2000 <https://en.wikipedia.org/wiki/Natura_2000>`_ natural protection areas. Area is excluded if ``true``.
potential -- One of {'simple', 'conservative'} Method to compute the maximal installable potential for a node; confer :ref:`renewableprofiles`
13 clip_p_max_pu p.u. float To avoid too small values in the renewables` per-unit availability time series values below this threshold are set to zero.
14 excluder_resolution m float Resolution on which to perform geographical elibility analysis.

View File

@ -161,8 +161,12 @@ if __name__ == "__main__":
gas_input_nodes.to_file(snakemake.output.gas_input_nodes, driver="GeoJSON") gas_input_nodes.to_file(snakemake.output.gas_input_nodes, driver="GeoJSON")
ensure_columns = ["lng", "pipeline", "production", "storage"]
gas_input_nodes_s = ( gas_input_nodes_s = (
gas_input_nodes.groupby(["bus", "type"])["capacity"].sum().unstack() gas_input_nodes.groupby(["bus", "type"])["capacity"]
.sum()
.unstack()
.reindex(columns=ensure_columns)
) )
gas_input_nodes_s.columns.name = "capacity" gas_input_nodes_s.columns.name = "capacity"

View File

@ -26,20 +26,9 @@ Relevant settings
renewable: renewable:
{technology}: {technology}:
cutout: cutout: corine: grid_codes: distance: natura: max_depth:
corine: max_shore_distance: min_shore_distance: capacity_per_sqkm:
grid_codes: correction_factor: min_p_max_pu: clip_p_max_pu: resource:
distance:
natura:
max_depth:
max_shore_distance:
min_shore_distance:
capacity_per_sqkm:
correction_factor:
potential:
min_p_max_pu:
clip_p_max_pu:
resource:
.. seealso:: .. seealso::
Documentation of the configuration file ``config/config.yaml`` at Documentation of the configuration file ``config/config.yaml`` at
@ -48,21 +37,30 @@ Relevant settings
Inputs Inputs
------ ------
- ``data/bundle/corine/g250_clc06_V18_5.tif``: `CORINE Land Cover (CLC) <https://land.copernicus.eu/pan-european/corine-land-cover>`_ inventory on `44 classes <https://wiki.openstreetmap.org/wiki/Corine_Land_Cover#Tagging>`_ of land use (e.g. forests, arable land, industrial, urban areas). - ``data/bundle/corine/g250_clc06_V18_5.tif``: `CORINE Land Cover (CLC)
<https://land.copernicus.eu/pan-european/corine-land-cover>`_ inventory on `44
classes <https://wiki.openstreetmap.org/wiki/Corine_Land_Cover#Tagging>`_ of
land use (e.g. forests, arable land, industrial, urban areas).
.. image:: img/corine.png .. image:: img/corine.png
:scale: 33 % :scale: 33 %
- ``data/bundle/GEBCO_2014_2D.nc``: A `bathymetric <https://en.wikipedia.org/wiki/Bathymetry>`_ data set with a global terrain model for ocean and land at 15 arc-second intervals by the `General Bathymetric Chart of the Oceans (GEBCO) <https://www.gebco.net/data_and_products/gridded_bathymetry_data/>`_. - ``data/bundle/GEBCO_2014_2D.nc``: A `bathymetric
<https://en.wikipedia.org/wiki/Bathymetry>`_ data set with a global terrain
model for ocean and land at 15 arc-second intervals by the `General
Bathymetric Chart of the Oceans (GEBCO)
<https://www.gebco.net/data_and_products/gridded_bathymetry_data/>`_.
.. image:: img/gebco_2019_grid_image.jpg .. image:: img/gebco_2019_grid_image.jpg
:scale: 50 % :scale: 50 %
**Source:** `GEBCO <https://www.gebco.net/data_and_products/images/gebco_2019_grid_image.jpg>`_ **Source:** `GEBCO
<https://www.gebco.net/data_and_products/images/gebco_2019_grid_image.jpg>`_
- ``resources/natura.tiff``: confer :ref:`natura` - ``resources/natura.tiff``: confer :ref:`natura`
- ``resources/offshore_shapes.geojson``: confer :ref:`shapes` - ``resources/offshore_shapes.geojson``: confer :ref:`shapes`
- ``resources/regions_onshore.geojson``: (if not offshore wind), confer :ref:`busregions` - ``resources/regions_onshore.geojson``: (if not offshore wind), confer
:ref:`busregions`
- ``resources/regions_offshore.geojson``: (if offshore wind), :ref:`busregions` - ``resources/regions_offshore.geojson``: (if offshore wind), :ref:`busregions`
- ``"cutouts/" + params["renewable"][{technology}]['cutout']``: :ref:`cutout` - ``"cutouts/" + params["renewable"][{technology}]['cutout']``: :ref:`cutout`
- ``networks/base.nc``: :ref:`base` - ``networks/base.nc``: :ref:`base`
@ -128,25 +126,25 @@ Description
This script functions at two main spatial resolutions: the resolution of the This script functions at two main spatial resolutions: the resolution of the
network nodes and their `Voronoi cells network nodes and their `Voronoi cells
<https://en.wikipedia.org/wiki/Voronoi_diagram>`_, and the resolution of the <https://en.wikipedia.org/wiki/Voronoi_diagram>`_, and the resolution of the
cutout grid cells for the weather data. Typically the weather data grid is cutout grid cells for the weather data. Typically the weather data grid is finer
finer than the network nodes, so we have to work out the distribution of than the network nodes, so we have to work out the distribution of generators
generators across the grid cells within each Voronoi cell. This is done by across the grid cells within each Voronoi cell. This is done by taking account
taking account of a combination of the available land at each grid cell and the of a combination of the available land at each grid cell and the capacity factor
capacity factor there. there.
First the script computes how much of the technology can be installed at each First the script computes how much of the technology can be installed at each
cutout grid cell and each node using the `GLAES cutout grid cell and each node using the `GLAES
<https://github.com/FZJ-IEK3-VSA/glaes>`_ library. This uses the CORINE land use data, <https://github.com/FZJ-IEK3-VSA/glaes>`_ library. This uses the CORINE land use
Natura2000 nature reserves and GEBCO bathymetry data. data, Natura2000 nature reserves and GEBCO bathymetry data.
.. image:: img/eligibility.png .. image:: img/eligibility.png
:scale: 50 % :scale: 50 %
:align: center :align: center
To compute the layout of generators in each node's Voronoi cell, the To compute the layout of generators in each node's Voronoi cell, the installable
installable potential in each grid cell is multiplied with the capacity factor potential in each grid cell is multiplied with the capacity factor at each grid
at each grid cell. This is done since we assume more generators are installed cell. This is done since we assume more generators are installed at cells with a
at cells with a higher capacity factor. higher capacity factor.
.. image:: img/offwinddc-gridcell.png .. image:: img/offwinddc-gridcell.png
:scale: 50 % :scale: 50 %
@ -164,20 +162,14 @@ at cells with a higher capacity factor.
:scale: 50 % :scale: 50 %
:align: center :align: center
This layout is then used to compute the generation availability time series This layout is then used to compute the generation availability time series from
from the weather data cutout from ``atlite``. the weather data cutout from ``atlite``.
Two methods are available to compute the maximal installable potential for the The maximal installable potential for the node (`p_nom_max`) is computed by
node (`p_nom_max`): ``simple`` and ``conservative``: adding up the installable potentials of the individual grid cells.
If the model comes close to this limit, then the time series may slightly
- ``simple`` adds up the installable potentials of the individual grid cells. overestimate production since it is assumed the geographical distribution is
If the model comes close to this limit, then the time series may slightly proportional to capacity factor.
overestimate production since it is assumed the geographical distribution is
proportional to capacity factor.
- ``conservative`` assertains the nodal limit by increasing capacities
proportional to the layout until the limit of an individual grid cell is
reached.
""" """
import functools import functools
import logging import logging
@ -210,7 +202,6 @@ if __name__ == "__main__":
resource = params["resource"] # pv panel params / wind turbine params resource = params["resource"] # pv panel params / wind turbine params
correction_factor = params.get("correction_factor", 1.0) correction_factor = params.get("correction_factor", 1.0)
capacity_per_sqkm = params["capacity_per_sqkm"] capacity_per_sqkm = params["capacity_per_sqkm"]
p_nom_max_meth = params.get("potential", "conservative")
if isinstance(params.get("corine", {}), list): if isinstance(params.get("corine", {}), list):
params["corine"] = {"grid_codes": params["corine"]} params["corine"] = {"grid_codes": params["corine"]}
@ -330,17 +321,8 @@ if __name__ == "__main__":
f"Completed weighted capacity factor time series calculation ({duration:2.2f}s)" f"Completed weighted capacity factor time series calculation ({duration:2.2f}s)"
) )
logger.info(f"Calculating maximal capacity per bus (method '{p_nom_max_meth}')") logger.info(f"Calculating maximal capacity per bus")
if p_nom_max_meth == "simple":
p_nom_max = capacity_per_sqkm * availability @ area p_nom_max = capacity_per_sqkm * availability @ area
elif p_nom_max_meth == "conservative":
max_cap_factor = capacity_factor.where(availability != 0).max(["x", "y"])
p_nom_max = capacities / max_cap_factor
else:
raise AssertionError(
'Config key `potential` should be one of "simple" '
f'(default) or "conservative", not "{p_nom_max_meth}"'
)
logger.info("Calculate average distances.") logger.info("Calculate average distances.")
layoutmatrix = (layout * availability).stack(spatial=["y", "x"]) layoutmatrix = (layout * availability).stack(spatial=["y", "x"])