From 86540775197d9861a0a1fa8e143ce144ec2a6f16 Mon Sep 17 00:00:00 2001 From: euronion <42553970+euronion@users.noreply.github.com> Date: Mon, 28 Jun 2021 16:20:29 +0200 Subject: [PATCH] Fix creation of renewable profiles for offshore wind. (#255) * Update build_renewable_profiles.py * Update release_notes.rst * Update release_notes.rst * Update release_notes.rst * Update scripts/build_renewable_profiles.py Co-authored-by: FabianHofmann * Adjust doc string Co-authored-by: FabianHofmann Co-authored-by: Fabian --- doc/release_notes.rst | 3 ++- scripts/build_renewable_profiles.py | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/doc/release_notes.rst b/doc/release_notes.rst index 0294d2d0..230fc67d 100644 --- a/doc/release_notes.rst +++ b/doc/release_notes.rst @@ -1,5 +1,5 @@ .. - SPDX-FileCopyrightText: 2019-2020 The PyPSA-Eur Authors + SPDX-FileCopyrightText: 2019-2021 The PyPSA-Eur Authors SPDX-License-Identifier: CC-BY-4.0 @@ -23,6 +23,7 @@ Upcoming Release * Bugfix in :mod:`solve_operations_network`: optimised capacities are now fixed for all extendable links, not only HVDC links [`#244 `_]. * The ``focus_weights`` are now also considered when pre-clustering in the :mod:`simplify_network` rule [`#241 `_]. * Continuous integration testing switches to Github Actions from Travis CI [`#252 `_]. +* Bugfix in :mod:`build_renewable_profile` where offshore wind profiles could no longer be created [`#249 `_]. PyPSA-Eur 0.3.0 (7th December 2020) ================================== diff --git a/scripts/build_renewable_profiles.py b/scripts/build_renewable_profiles.py index f7e1bc7f..111eb772 100644 --- a/scripts/build_renewable_profiles.py +++ b/scripts/build_renewable_profiles.py @@ -183,6 +183,7 @@ import progressbar as pgb import geopandas as gpd import xarray as xr import numpy as np +import functools import atlite import logging from pypsa.geo import haversine @@ -235,7 +236,10 @@ if __name__ == '__main__': excluder.add_raster(paths.corine, codes=codes, buffer=buffer, crs=3035) if "max_depth" in config: - func = lambda v: v <= -config['max_depth'] + # lambda not supported for atlite + multiprocessing + # use named function np.greater with partially frozen argument instead + # and exclude areas where: -max_depth > grid cell depth + func = functools.partial(np.greater,-config['max_depth']) excluder.add_raster(paths.gebco, codes=func, crs=4236, nodata=-1000) if 'min_shore_distance' in config: