diff --git a/.gitignore b/.gitignore index a2473d8d..4e7e88e1 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,7 @@ atlite.egg-info/ doc/.vscode/settings.json .vscode/settings.json test/*.nc +dev-scripts/ examples/*.nc examples/*.csv examples/*.zip diff --git a/RELEASE_NOTES.rst b/RELEASE_NOTES.rst index e47abf48..2eb834b2 100644 --- a/RELEASE_NOTES.rst +++ b/RELEASE_NOTES.rst @@ -9,9 +9,13 @@ 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 `_) +* Compatibility with xarray >= 2023.09.: The chunked spatial dimension in `aggregate` was raising an error with the new xarray version. This is fixed now. * Bug fix: Some wind turbine models did not include a cut-out wind speed, potentially causing overestimated power generation in windy conditions. Cut-out wind speeds were added to the following affected wind turbine models (`#316 `_): * NREL_ReferenceTurbine_2016CACost_10MW_offshore * NREL_ReferenceTurbine_2016CACost_6MW_offshore @@ -21,9 +25,9 @@ Release Notes * NREL_ReferenceTurbine_2020ATB_12MW_offshore * NREL_ReferenceTurbine_2020ATB_15MW_offshore * NREL_ReferenceTurbine_2020ATB_18MW_offshore -.. * 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 `_) +* 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 `_) Version 0.2.11 diff --git a/atlite/aggregate.py b/atlite/aggregate.py index 9f01b89e..edada33f 100644 --- a/atlite/aggregate.py +++ b/atlite/aggregate.py @@ -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, diff --git a/atlite/cutout.py b/atlite/cutout.py index db042be9..2b95e9b0 100644 --- a/atlite/cutout.py +++ b/atlite/cutout.py @@ -180,7 +180,8 @@ def __init__(self, path, **cutoutparams): # Three cases. First, cutout exists -> take the data. # Second, data is given -> take it. Third, else -> build a new cutout if path.is_file(): - data = xr.open_dataset(str(path), chunks=chunks) + data = xr.open_dataset(str(path)) + data = data.chunk(chunks) data.attrs.update(storable_chunks) if cutoutparams: warn( @@ -403,7 +404,8 @@ def grid(self): span = (coords[self.shape[1] + 1] - coords[0]) / 2 cells = [box(*c) for c in np.hstack((coords - span, coords + span))] return gpd.GeoDataFrame( - {"x": coords[:, 0], "y": coords[:, 1], "geometry": cells}, crs=self.crs + {"x": coords[:, 0], "y": coords[:, 1], "geometry": cells}, + crs=self.crs, ) def sel(self, path=None, bounds=None, buffer=0, **kwargs):