Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CF timeseries per gridcell #330

Merged
merged 4 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.