[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
ce609b6ebe
commit
326aeb682b
@ -13,7 +13,7 @@ scenario:
|
|||||||
- 2050
|
- 2050
|
||||||
|
|
||||||
countries:
|
countries:
|
||||||
- UA
|
- UA
|
||||||
|
|
||||||
enable:
|
enable:
|
||||||
retrieve: true
|
retrieve: true
|
||||||
@ -21,4 +21,3 @@ enable:
|
|||||||
retrieve_sector_databundle: false
|
retrieve_sector_databundle: false
|
||||||
retrieve_cost_data: true
|
retrieve_cost_data: true
|
||||||
retrieve_cutout: false
|
retrieve_cutout: false
|
||||||
|
|
||||||
|
@ -210,10 +210,8 @@ rule determine_availability_matrix_MD_UA:
|
|||||||
input:
|
input:
|
||||||
copernicus=RESOURCES
|
copernicus=RESOURCES
|
||||||
+ "Copernicus_LC100_global_v3.0.1_2019-nrt_Discrete-Classification-map_EPSG-4326.tif",
|
+ "Copernicus_LC100_global_v3.0.1_2019-nrt_Discrete-Classification-map_EPSG-4326.tif",
|
||||||
wdpa=RESOURCES
|
wdpa=RESOURCES + f"WDPA_{bYYYY}.gpkg",
|
||||||
+ f"WDPA_{bYYYY}.gpkg",
|
wdpa_marine=RESOURCES + f"WDPA_WDOECM_{bYYYY}_marine.gpkg",
|
||||||
wdpa_marine=RESOURCES
|
|
||||||
+ f"WDPA_WDOECM_{bYYYY}_marine.gpkg",
|
|
||||||
gebco=lambda w: (
|
gebco=lambda w: (
|
||||||
"data/bundle/GEBCO_2014_2D.nc"
|
"data/bundle/GEBCO_2014_2D.nc"
|
||||||
if "max_depth" in config["renewable"][w.technology].keys()
|
if "max_depth" in config["renewable"][w.technology].keys()
|
||||||
|
@ -368,16 +368,19 @@ def _apply_parameter_corrections(n, parameter_corrections):
|
|||||||
|
|
||||||
def _reconnect_crimea(lines):
|
def _reconnect_crimea(lines):
|
||||||
logger.info("Reconnecting Crimea to the Ukrainian grid.")
|
logger.info("Reconnecting Crimea to the Ukrainian grid.")
|
||||||
lines_to_crimea = pd.DataFrame({
|
lines_to_crimea = pd.DataFrame(
|
||||||
"bus0": ["3065", "3181", "3181"],
|
{
|
||||||
"bus1": ["3057", "3055", "3057"],
|
"bus0": ["3065", "3181", "3181"],
|
||||||
"v_nom": [300, 300, 300],
|
"bus1": ["3057", "3055", "3057"],
|
||||||
"num_parallel": [1, 1, 1],
|
"v_nom": [300, 300, 300],
|
||||||
"length": [140, 120, 140],
|
"num_parallel": [1, 1, 1],
|
||||||
"carrier": ["AC", "AC", "AC"],
|
"length": [140, 120, 140],
|
||||||
"underground": [False, False, False],
|
"carrier": ["AC", "AC", "AC"],
|
||||||
"under_construction": [False, False, False],
|
"underground": [False, False, False],
|
||||||
}, index=["Melitopol", "Liubymivka left", "Luibymivka right"])
|
"under_construction": [False, False, False],
|
||||||
|
},
|
||||||
|
index=["Melitopol", "Liubymivka left", "Luibymivka right"],
|
||||||
|
)
|
||||||
|
|
||||||
return pd.concat([lines, lines_to_crimea])
|
return pd.concat([lines, lines_to_crimea])
|
||||||
|
|
||||||
|
@ -18,11 +18,15 @@ from rasterio.plot import show
|
|||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def get_wdpa_layer_name(wdpa_fn, layer_substring):
|
def get_wdpa_layer_name(wdpa_fn, layer_substring):
|
||||||
"""Get layername from file "wdpa_fn" whose name contains "layer_substring"."""
|
"""
|
||||||
|
Get layername from file "wdpa_fn" whose name contains "layer_substring".
|
||||||
|
"""
|
||||||
l = fiona.listlayers(wdpa_fn)
|
l = fiona.listlayers(wdpa_fn)
|
||||||
return [_ for _ in l if layer_substring in _][0]
|
return [_ for _ in l if layer_substring in _][0]
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
if "snakemake" not in globals():
|
if "snakemake" not in globals():
|
||||||
from _helpers import mock_snakemake
|
from _helpers import mock_snakemake
|
||||||
@ -32,7 +36,7 @@ if __name__ == "__main__":
|
|||||||
)
|
)
|
||||||
configure_logging(snakemake)
|
configure_logging(snakemake)
|
||||||
|
|
||||||
nprocesses = None # snakemake.config["atlite"].get("nprocesses")
|
nprocesses = None # snakemake.config["atlite"].get("nprocesses")
|
||||||
noprogress = not snakemake.config["atlite"].get("show_progress", True)
|
noprogress = not snakemake.config["atlite"].get("show_progress", True)
|
||||||
config = snakemake.config["renewable"][snakemake.wildcards.technology]
|
config = snakemake.config["renewable"][snakemake.wildcards.technology]
|
||||||
|
|
||||||
@ -74,7 +78,11 @@ if __name__ == "__main__":
|
|||||||
)
|
)
|
||||||
|
|
||||||
if config["natura"]:
|
if config["natura"]:
|
||||||
wdpa_fn = snakemake.input.wdpa_marine if "offwind" in snakemake.wildcards.technology else snakemake.input.wdpa
|
wdpa_fn = (
|
||||||
|
snakemake.input.wdpa_marine
|
||||||
|
if "offwind" in snakemake.wildcards.technology
|
||||||
|
else snakemake.input.wdpa
|
||||||
|
)
|
||||||
layer = get_wdpa_layer_name(wdpa_fn, "polygons")
|
layer = get_wdpa_layer_name(wdpa_fn, "polygons")
|
||||||
wdpa = gpd.read_file(
|
wdpa = gpd.read_file(
|
||||||
wdpa_fn,
|
wdpa_fn,
|
||||||
@ -92,7 +100,9 @@ if __name__ == "__main__":
|
|||||||
).to_crs(3035)
|
).to_crs(3035)
|
||||||
wdpa_pts = wdpa_pts[wdpa_pts["REP_AREA"] > 1]
|
wdpa_pts = wdpa_pts[wdpa_pts["REP_AREA"] > 1]
|
||||||
wdpa_pts["buffer_radius"] = np.sqrt(wdpa_pts["REP_AREA"] / np.pi) * 1000
|
wdpa_pts["buffer_radius"] = np.sqrt(wdpa_pts["REP_AREA"] / np.pi) * 1000
|
||||||
wdpa_pts = wdpa_pts.set_geometry(wdpa_pts["geometry"].buffer(wdpa_pts["buffer_radius"]))
|
wdpa_pts = wdpa_pts.set_geometry(
|
||||||
|
wdpa_pts["geometry"].buffer(wdpa_pts["buffer_radius"])
|
||||||
|
)
|
||||||
if not wdpa_pts.empty:
|
if not wdpa_pts.empty:
|
||||||
excluder.add_geometry(wdpa_pts.geometry)
|
excluder.add_geometry(wdpa_pts.geometry)
|
||||||
|
|
||||||
@ -135,7 +145,7 @@ if __name__ == "__main__":
|
|||||||
fig, ax = plt.subplots(figsize=(4, 8))
|
fig, ax = plt.subplots(figsize=(4, 8))
|
||||||
gpd.GeoSeries(regions_geometry.unary_union).plot(ax=ax, color="none")
|
gpd.GeoSeries(regions_geometry.unary_union).plot(ax=ax, color="none")
|
||||||
show(band, transform=transform, cmap="Greens", ax=ax)
|
show(band, transform=transform, cmap="Greens", ax=ax)
|
||||||
plt.axis('off')
|
plt.axis("off")
|
||||||
plt.savefig(snakemake.output.availability_map, bbox_inches="tight", dpi=500)
|
plt.savefig(snakemake.output.availability_map, bbox_inches="tight", dpi=500)
|
||||||
|
|
||||||
# Limit results only to buses for UA and MD
|
# Limit results only to buses for UA and MD
|
||||||
|
Loading…
Reference in New Issue
Block a user