From 9d431b613b29122d4e1d90068187da3fb7def5aa Mon Sep 17 00:00:00 2001 From: martavp Date: Tue, 7 Nov 2023 11:15:53 +0100 Subject: [PATCH 1/4] include capacity_factor_timeseries in convert_and_aggregate --- atlite/convert.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/atlite/convert.py b/atlite/convert.py index 1baaa07d..6c92db5e 100644 --- a/atlite/convert.py +++ b/atlite/convert.py @@ -50,6 +50,7 @@ def convert_and_aggregate( per_unit=False, return_capacity=False, capacity_factor=False, + capacity_factor_timeseries=False, show_progress=True, dask_kwargs={}, **convert_kwds, @@ -87,6 +88,9 @@ def convert_and_aggregate( capacity_factor : boolean If True, the static capacity factor of the chosen resource for each grid cell is computed. + capacity_factor_timeseries : boolean + If True, the capacity factor time series of the chosen resource for + each grid cell is computed. show_progress : boolean, default True Whether to show a progress bar. dask_kwargs : dict, default {} @@ -122,7 +126,10 @@ def convert_and_aggregate( "given for `per_unit` or `return_capacity`" ) if capacity_factor: - res = da.mean("time").rename("capacity factor") + if capacity_factor_timeseries: + res = da.rename("capacity factor") + else: + res = da.mean("time").rename("capacity factor") res.attrs["units"] = "p.u." return maybe_progressbar(res, show_progress, **dask_kwargs) else: From d6687e4e75dd70af0a9ab39615ddf301b47d4647 Mon Sep 17 00:00:00 2001 From: martavp Date: Tue, 7 Nov 2023 11:20:30 +0100 Subject: [PATCH 2/4] Update release_notes.rst --- doc/release_notes.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/release_notes.rst b/doc/release_notes.rst index ea1ab2c6..22209199 100644 --- a/doc/release_notes.rst +++ b/doc/release_notes.rst @@ -8,3 +8,6 @@ * In ``atlite/resource.py``, the functions ``get_windturbineconfig``, ``get_solarpanelconfig``, and ``get_cspinstallationconfig`` will now recognize if a local file was passed, and if so load it instead of one of the predefined ones. + +* The option ``capacity_factor_timeseries`` can be selected when creating capacity factors to obtain + the capacity factor of the selected resource per grid cell. From d47e546701c2c791a63313f2410e782c5c53a20b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 7 Nov 2023 10:23:42 +0000 Subject: [PATCH 3/4] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- doc/release_notes.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/release_notes.rst b/doc/release_notes.rst index 22209199..12af260b 100644 --- a/doc/release_notes.rst +++ b/doc/release_notes.rst @@ -10,4 +10,4 @@ it instead of one of the predefined ones. * The option ``capacity_factor_timeseries`` can be selected when creating capacity factors to obtain - the capacity factor of the selected resource per grid cell. + the capacity factor of the selected resource per grid cell. From d63dbd1efa991dab6c2e4a30d0412d26abb9ecd7 Mon Sep 17 00:00:00 2001 From: martavp <30744159+martavp@users.noreply.github.com> Date: Wed, 8 Nov 2023 07:58:19 +0100 Subject: [PATCH 4/4] Update atlite/convert.py Co-authored-by: Fabian Hofmann --- atlite/convert.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/atlite/convert.py b/atlite/convert.py index 6c92db5e..3c41e75e 100644 --- a/atlite/convert.py +++ b/atlite/convert.py @@ -125,7 +125,7 @@ def convert_and_aggregate( "One of `matrix`, `shapes` and `layout` must be " "given for `per_unit` or `return_capacity`" ) - if capacity_factor: + if capacity_factor or capacity_factor_timeseries: if capacity_factor_timeseries: res = da.rename("capacity factor") else: