2023-03-06 08:27:45 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
2023-03-06 17:49:23 +00:00
|
|
|
# SPDX-FileCopyrightText: : 2023 The PyPSA-Eur Authors
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: MIT
|
2023-03-09 11:45:43 +00:00
|
|
|
"""
|
|
|
|
Build regionalised geological sequestration potential for carbon dioxide using
|
2023-03-10 15:56:32 +00:00
|
|
|
data from `CO2Stop <https://setis.ec.europa.eu/european-co2-storage-
|
|
|
|
database_en>`_.
|
2023-03-09 11:45:43 +00:00
|
|
|
"""
|
|
|
|
|
2023-01-24 17:44:39 +00:00
|
|
|
import geopandas as gpd
|
|
|
|
import pandas as pd
|
2023-03-06 08:27:45 +00:00
|
|
|
|
2023-01-24 17:44:39 +00:00
|
|
|
|
|
|
|
def area(gdf):
|
|
|
|
"""
|
|
|
|
Returns area of GeoDataFrame geometries in square kilometers.
|
|
|
|
"""
|
|
|
|
return gdf.to_crs(epsg=3035).area.div(1e6)
|
|
|
|
|
|
|
|
|
|
|
|
def allocate_sequestration_potential(
|
|
|
|
gdf, regions, attr="conservative estimate Mt", threshold=3
|
|
|
|
):
|
|
|
|
gdf = gdf.loc[gdf[attr] > threshold, [attr, "geometry"]]
|
|
|
|
gdf["area_sqkm"] = area(gdf)
|
|
|
|
overlay = gpd.overlay(regions, gdf, keep_geom_type=True)
|
|
|
|
overlay["share"] = area(overlay) / overlay["area_sqkm"]
|
|
|
|
adjust_cols = overlay.columns.difference({"name", "area_sqkm", "geometry", "share"})
|
|
|
|
overlay[adjust_cols] = overlay[adjust_cols].multiply(overlay["share"], axis=0)
|
2023-08-14 12:39:51 +00:00
|
|
|
return overlay.dissolve("name", aggfunc="sum")[attr]
|
2023-01-24 17:44:39 +00:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
if "snakemake" not in globals():
|
2023-03-06 18:09:45 +00:00
|
|
|
from _helpers import mock_snakemake
|
2023-03-06 08:27:45 +00:00
|
|
|
|
2023-01-24 17:44:39 +00:00
|
|
|
snakemake = mock_snakemake(
|
|
|
|
"build_sequestration_potentials", simpl="", clusters="181"
|
|
|
|
)
|
|
|
|
|
2023-06-15 17:12:30 +00:00
|
|
|
cf = snakemake.params.sequestration_potential
|
2023-01-24 17:44:39 +00:00
|
|
|
|
2023-02-08 21:57:01 +00:00
|
|
|
gdf = gpd.read_file(snakemake.input.sequestration_potential[0])
|
2023-01-24 17:44:39 +00:00
|
|
|
|
|
|
|
regions = gpd.read_file(snakemake.input.regions_offshore)
|
2023-02-16 16:21:58 +00:00
|
|
|
if cf["include_onshore"]:
|
2023-01-24 17:44:39 +00:00
|
|
|
onregions = gpd.read_file(snakemake.input.regions_onshore)
|
|
|
|
regions = pd.concat([regions, onregions]).dissolve(by="name").reset_index()
|
|
|
|
|
2023-02-16 16:21:58 +00:00
|
|
|
s = allocate_sequestration_potential(
|
|
|
|
gdf, regions, attr=cf["attribute"], threshold=cf["min_size"]
|
|
|
|
)
|
2023-01-24 17:44:39 +00:00
|
|
|
|
2023-02-16 16:21:58 +00:00
|
|
|
s = s.where(s > cf["min_size"]).dropna()
|
2023-01-24 17:44:39 +00:00
|
|
|
|
|
|
|
s.to_csv(snakemake.output.sequestration_potential)
|