Merge branch 'master' into store-network-shapes

This commit is contained in:
Fabian Hofmann 2024-04-10 17:49:30 +02:00 committed by GitHub
commit af3be19ef4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 24 additions and 6 deletions

View File

@ -20,6 +20,7 @@ remote:
# docs in https://pypsa-eur.readthedocs.io/en/latest/configuration.html#run # docs in https://pypsa-eur.readthedocs.io/en/latest/configuration.html#run
run: run:
prefix: ""
name: "" name: ""
scenarios: scenarios:
enable: false enable: false
@ -515,7 +516,11 @@ sector:
regional_coal_demand: false regional_coal_demand: false
regional_co2_sequestration_potential: regional_co2_sequestration_potential:
enable: false enable: false
attribute: 'conservative estimate Mt' attribute:
- conservative estimate Mt
- conservative estimate GAS Mt
- conservative estimate OIL Mt
- conservative estimate aquifer Mt
include_onshore: false include_onshore: false
min_size: 3 min_size: 3
max_size: 25 max_size: 25

View File

@ -1,5 +1,6 @@
,Unit,Values,Description ,Unit,Values,Description
name,--,str/list,"Specify a name for your run. Results will be stored under this name. If ``scenario: enable:`` is set to ``true``, the name must contain a subset of scenario names defined in ``scenario: file:``. If the name is 'all', all defined scenarios will be run." name,--,str/list,"Specify a name for your run. Results will be stored under this name. If ``scenario: enable:`` is set to ``true``, the name must contain a subset of scenario names defined in ``scenario: file:``. If the name is 'all', all defined scenarios will be run."
prefix,--,str,"Prefix for the run name which is used as a top-layer directory name in the results and resources folders."
scenarios,,, scenarios,,,
-- enable,bool,"{true, false}","Switch to select whether workflow should generate scenarios based on ``file``." -- enable,bool,"{true, false}","Switch to select whether workflow should generate scenarios based on ``file``."
-- file,str,,"Path to the scenario yaml file. The scenario file contains config overrides for each scenario. In order to be taken account, ``run: scenarios`` has to be set to ``true`` and ``run: name`` has to be a subset of top level keys given in the scenario file. In order to automatically create a `scenario.yaml` file based on a combination of settings, alter and use the ``config/create_scenarios.py`` script in the ``config`` directory." -- file,str,,"Path to the scenario yaml file. The scenario file contains config overrides for each scenario. In order to be taken account, ``run: scenarios`` has to be set to ``true`` and ``run: name`` has to be a subset of top level keys given in the scenario file. In order to automatically create a `scenario.yaml` file based on a combination of settings, alter and use the ``config/create_scenarios.py`` script in the ``config`` directory."

1 Unit Values Description
2 name -- str/list Specify a name for your run. Results will be stored under this name. If ``scenario: enable:`` is set to ``true``, the name must contain a subset of scenario names defined in ``scenario: file:``. If the name is 'all', all defined scenarios will be run.
3 prefix -- str Prefix for the run name which is used as a top-layer directory name in the results and resources folders.
4 scenarios
5 -- enable bool {true, false} Switch to select whether workflow should generate scenarios based on ``file``.
6 -- file str Path to the scenario yaml file. The scenario file contains config overrides for each scenario. In order to be taken account, ``run: scenarios`` has to be set to ``true`` and ``run: name`` has to be a subset of top level keys given in the scenario file. In order to automatically create a `scenario.yaml` file based on a combination of settings, alter and use the ``config/create_scenarios.py`` script in the ``config`` directory.

View File

@ -90,7 +90,7 @@ regional_methanol_demand,--,"{true, false}",Spatially resolve methanol demand. S
regional_oil_demand,--,"{true, false}",Spatially resolve oil demand. Set to true if regional CO2 constraints needed. regional_oil_demand,--,"{true, false}",Spatially resolve oil demand. Set to true if regional CO2 constraints needed.
regional_co2 _sequestration_potential,,, regional_co2 _sequestration_potential,,,
-- enable,--,"{true, false}",Add option for regionally-resolved geological carbon dioxide sequestration potentials based on `CO2StoP <https://setis.ec.europa.eu/european-co2-storage-database_en>`_. -- enable,--,"{true, false}",Add option for regionally-resolved geological carbon dioxide sequestration potentials based on `CO2StoP <https://setis.ec.europa.eu/european-co2-storage-database_en>`_.
-- attribute,--,string,Name of the attribute for the sequestration potential -- attribute,--,string or list,Name (or list of names) of the attribute(s) for the sequestration potential
-- include_onshore,--,"{true, false}",Add options for including onshore sequestration potentials -- include_onshore,--,"{true, false}",Add options for including onshore sequestration potentials
-- min_size,Gt ,float,Any sites with lower potential than this value will be excluded -- min_size,Gt ,float,Any sites with lower potential than this value will be excluded
-- max_size,Gt ,float,The maximum sequestration potential for any one site. -- max_size,Gt ,float,The maximum sequestration potential for any one site.
@ -143,5 +143,5 @@ limit_max_growth,,,
-- factor,p.u.,float,The maximum growth factor of a carrier (e.g. 1.3 allows 30% larger than max historic growth) -- factor,p.u.,float,The maximum growth factor of a carrier (e.g. 1.3 allows 30% larger than max historic growth)
-- max_growth,,, -- max_growth,,,
-- -- {carrier},GW,float,The historic maximum growth of a carrier -- -- {carrier},GW,float,The historic maximum growth of a carrier
-- max_relative_growth, -- max_relative_growth,,,
-- -- {carrier},p.u.,float,The historic maximum relative growth of a carrier -- -- {carrier},p.u.,float,The historic maximum relative growth of a carrier

Can't render this file because it has a wrong number of fields in line 146.

View File

@ -10,6 +10,8 @@ Release Notes
Upcoming Release Upcoming Release
================ ================
* Include gas and oil fields and saline aquifers in estimation of CO2 sequestration potential.
* bugfix: convert Strings to pathlib.Path objects as input to ConfigSettings * bugfix: convert Strings to pathlib.Path objects as input to ConfigSettings
* Allow the use of more solvers in clustering (Xpress, COPT, Gurobi, CPLEX, SCIP, MOSEK). * Allow the use of more solvers in clustering (Xpress, COPT, Gurobi, CPLEX, SCIP, MOSEK).
@ -152,6 +154,9 @@ Upcoming Release
- Collection rules get a new wildcard ``run=config["run"]["name"]`` so they - Collection rules get a new wildcard ``run=config["run"]["name"]`` so they
can collect outputs across different scenarios. can collect outputs across different scenarios.
- It is further possible to encapsulate your scenarios in a directory using
the setting ``run: prefix:``.
- **Warning:** One caveat remains for the scenario management with myopic or - **Warning:** One caveat remains for the scenario management with myopic or
perfect foresight pathway optimisation. The first investment period must be perfect foresight pathway optimisation. The first investment period must be
shared across all scenarios. The reason is that the ``wildcard_constraints`` shared across all scenarios. The reason is that the ``wildcard_constraints``

View File

@ -59,6 +59,11 @@ def get_rdir(run):
RDIR = run["name"] + "/" RDIR = run["name"] + "/"
else: else:
RDIR = "" RDIR = ""
prefix = run.get("prefix", "")
if prefix:
RDIR = f"{prefix}/{RDIR}"
return RDIR return RDIR

View File

@ -23,13 +23,15 @@ def area(gdf):
def allocate_sequestration_potential( def allocate_sequestration_potential(
gdf, regions, attr="conservative estimate Mt", threshold=3 gdf, regions, attr="conservative estimate Mt", threshold=3
): ):
gdf = gdf.loc[gdf[attr] > threshold, [attr, "geometry"]] if isinstance(attr, str):
attr = [attr]
gdf = gdf.loc[gdf[attr].sum(axis=1) > threshold, attr + ["geometry"]]
gdf["area_sqkm"] = area(gdf) gdf["area_sqkm"] = area(gdf)
overlay = gpd.overlay(regions, gdf, keep_geom_type=True) overlay = gpd.overlay(regions, gdf, keep_geom_type=True)
overlay["share"] = area(overlay) / overlay["area_sqkm"] overlay["share"] = area(overlay) / overlay["area_sqkm"]
adjust_cols = overlay.columns.difference({"name", "area_sqkm", "geometry", "share"}) adjust_cols = overlay.columns.difference({"name", "area_sqkm", "geometry", "share"})
overlay[adjust_cols] = overlay[adjust_cols].multiply(overlay["share"], axis=0) overlay[adjust_cols] = overlay[adjust_cols].multiply(overlay["share"], axis=0)
return overlay.dissolve("name", aggfunc="sum")[attr] return overlay.dissolve("name", aggfunc="sum")[attr].sum(axis=1)
if __name__ == "__main__": if __name__ == "__main__":
@ -37,7 +39,7 @@ if __name__ == "__main__":
from _helpers import mock_snakemake from _helpers import mock_snakemake
snakemake = mock_snakemake( snakemake = mock_snakemake(
"build_sequestration_potentials", simpl="", clusters="181" "build_sequestration_potentials", simpl="", clusters="128"
) )
set_scenario_config(snakemake) set_scenario_config(snakemake)