Skip to content

Commit

Permalink
aggregate: unchunk spatial dimension before apply_ufunc
Browse files Browse the repository at this point in the history
  • Loading branch information
FabianHofmann committed Oct 19, 2023
1 parent e1ad5db commit f0fdf1c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ atlite.egg-info/
doc/.vscode/settings.json
.vscode/settings.json
test/*.nc
dev-scripts/
examples/*.nc
examples/*.csv
examples/*.zip
Expand Down
12 changes: 7 additions & 5 deletions RELEASE_NOTES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@ Release Notes



.. Upcoming Release
.. ================
Upcoming Release
================

.. * Fix: the wind turbine power curve is checked for a missing cut-out wind speed and an option to add a
.. cut-out wind speed at the end of the power curve is introduced. From the next release v0.2.13, adding
.. a cut-out wind speed will be the default behavior (`GH #316 <https://github.com/PyPSA/atlite/pull/316>`_)

* Fix: the wind turbine power curve is checked for a missing cut-out wind speed and an option to add a
cut-out wind speed at the end of the power curve is introduced. From the next release v0.2.13, adding
a cut-out wind speed will be the default behavior (`GH #316 <https://github.com/PyPSA/atlite/pull/316>`_)
* Compatibility with xarray >= 2023.09.: The chunked spatial dimension in `aggregate` was raising an error with the new xarray version. This is fixed now.


Version 0.2.11
Expand Down
1 change: 1 addition & 0 deletions atlite/aggregate.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def aggregate_matrix(da, matrix, index):
index = index.rename("dim_0")
if isinstance(da.data, dask.array.core.Array):
da = da.stack(spatial=("y", "x"))
da = da.chunk(dict(spatial=-1))
return xr.apply_ufunc(
lambda da: da * matrix.T,
da,
Expand Down

0 comments on commit f0fdf1c

Please sign in to comment.