Skip to content

Commit

Permalink
Merge pull request #330 from martavp/CF_timeseries_per_gridcell
Browse files Browse the repository at this point in the history
CF timeseries per gridcell
  • Loading branch information
FabianHofmann authored Nov 8, 2023
2 parents 5f1f51b + d63dbd1 commit 83c3bf0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
11 changes: 9 additions & 2 deletions atlite/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 {}
Expand Down Expand Up @@ -121,8 +125,11 @@ def convert_and_aggregate(
"One of `matrix`, `shapes` and `layout` must be "
"given for `per_unit` or `return_capacity`"
)
if capacity_factor:
res = da.mean("time").rename("capacity factor")
if capacity_factor or capacity_factor_timeseries:
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:
Expand Down
3 changes: 3 additions & 0 deletions doc/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.

0 comments on commit 83c3bf0

Please sign in to comment.