Skip to content

Commit 1e6a0b8

Browse files
euronionlkstrp
andauthored
Address deprecation warnings (#453)
* code: Change default for add_cutout_windspeed * code: Address rasterio DeprecationWarning on crs.is_valid * doc: Update release notes --------- Co-authored-by: Lukas Trippe <[email protected]>
1 parent 01b5ae6 commit 1e6a0b8

File tree

3 files changed

+23
-18
lines changed

3 files changed

+23
-18
lines changed

RELEASE_NOTES.rst

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,26 @@ Release Notes
88
#############
99

1010

11-
.. Upcoming Release
12-
.. ================
11+
Upcoming Release
12+
================
1313

14-
.. .. warning::
14+
.. warning::
1515

16-
.. The features listed below are not released yet, but will be part of the next release!
17-
.. To use the features already you have to install the ``master`` branch, e.g.
18-
.. ``pip install git+https://github.com/pypsa/atlite``.
16+
The features listed below are not released yet, but will be part of the next release!
17+
To use the features already you have to install the ``master`` branch, e.g.
18+
``pip install git+https://github.com/pypsa/atlite``.
19+
20+
**Breaking**
21+
* Set `add_cutout_windspeed = True` as default for `get_windturbineconfig` to ensure that the cutout wind speed is always added to the turbine configuration (`GH #316 <https://github.com/PyPSA/atlite/pull/316>`_);
22+
removed the `DeprecationWarning`.
23+
24+
**Features**
25+
* Add new onshore turbine models: eno 126 3.5 MW, eno 126 4 MW, and eno 126 4.8 MW . (turbines that match more closely the PyPSA/technologydata cost assumptions)
1926

20-
* Feature: Add new onshore turbine models: eno 126 3.5 MW, eno 126 4 MW, and eno 126 4.8 MW . (turbines that match more closely the PyPSA/technologydata cost assumptions)
27+
**Bug fixes**
2128
* Fix `atlite.Cutout()` to be able to handle the `bounds` argument to be a `DataFrame` in accordance to the docstring (https://github.com/PyPSA/atlite/pull/445).
2229
* Raise a `FileNotFoundError` if the `temp_dir` explicitly specified for cutout preparation does not exist instead of failing with an obfuscated error message (https://github.com/PyPSA/atlite/pull/445).
30+
* Addressed `rasterio` DeprecationWarning on `crs.is_valid`.
2331

2432
`v0.4.1 <https://github.com/PyPSA/atlite/releases/tag/v0.4.1>`__ (12th May 2025)
2533
=======================================================================================

atlite/gis.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,9 @@ def open_files(self):
477477
raster = rio.open(raster)
478478
else:
479479
assert isinstance(raster, rio.DatasetReader)
480-
if not raster.crs.is_valid if raster.crs is not None else True:
480+
481+
# Check if the raster has a valid CRS
482+
if not raster.crs:
481483
if d["crs"]:
482484
raster._crs = CRS(d["crs"])
483485
else:

atlite/resource.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import json
1212
import logging
1313
import re
14-
import warnings
1514
from operator import itemgetter
1615
from pathlib import Path
1716
from typing import TYPE_CHECKING
@@ -49,7 +48,7 @@ class TurbineConfig(TypedDict):
4948

5049

5150
def get_windturbineconfig(
52-
turbine: str | Path | dict, add_cutout_windspeed: bool = False
51+
turbine: str | Path | dict, add_cutout_windspeed: bool = True
5352
) -> TurbineConfig:
5453
"""
5554
Load the wind 'turbine' configuration.
@@ -69,7 +68,7 @@ def get_windturbineconfig(
6968
a user provided config dict. Needs to have the keys "POW", "V", "P", and
7069
"hub_height". Values for "POW" and "V" need to be list or np.ndarray with
7170
equal length.
72-
add_cutout_windspeed : bool
71+
add_cutout_windspeed : bool = True
7372
If True and in case the power curve does not end with a zero, will add zero power
7473
output at the highest wind speed in the power curve. If False, a warning will be
7574
raised if the power curve does not have a cut-out wind speed.
@@ -80,14 +79,10 @@ def get_windturbineconfig(
8079
Config with details on the turbine
8180
8281
"""
83-
assert isinstance(turbine, (str | Path | dict))
84-
85-
if add_cutout_windspeed is False:
86-
msg = (
87-
"'add_cutout_windspeed' for wind turbine\npower curves will default to "
88-
"True in atlite relase v0.2.15."
82+
if not isinstance(turbine, (str | Path | dict)):
83+
raise KeyError(
84+
f"`turbine` must be a str, pathlib.Path or dict, but is {type(turbine)}."
8985
)
90-
warnings.warn(msg, FutureWarning)
9186

9287
if isinstance(turbine, str) and turbine.startswith("oedb:"):
9388
conf = get_oedb_windturbineconfig(turbine[len("oedb:") :])

0 commit comments

Comments
 (0)