Skip to content

Commit cd6ed20

Browse files
committed
MNT: warn when using rio.set_crs() that deprecation is possible and to use rio.write_crs() instead
1 parent f325155 commit cd6ed20

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

rioxarray/rioxarray.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
This module is an extension for xarray to provide rasterio capabilities
33
to xarray datasets/dataarrays.
44
"""
5+
56
# pylint: disable=too-many-lines
67
import json
78
import math
@@ -375,6 +376,13 @@ def set_crs(
375376
:obj:`xarray.Dataset` | :obj:`xarray.DataArray`:
376377
Dataset with crs attribute.
377378
"""
379+
warnings.warn(
380+
"It is recommended to use `rio.write_crs()` instead. `rio.set_crs() will likely"
381+
"be removed in a future release.",
382+
DeprecationWarning,
383+
stacklevel=2,
384+
)
385+
378386
crs = crs_from_user_input(input_crs)
379387
obj = self._get_obj(inplace=inplace)
380388
obj.rio._crs = crs

0 commit comments

Comments
 (0)