Skip to content

Commit 3a32169

Browse files
authored
Replace rio.set_crs with rio.write_crs in load_tile_map function (#3321)
* Replace rio.set_crs with rio.write_crs in load_tile_map function Rioxarray 0.16.0 has deprecated the use of `set_crs` in favour of `write_crs`. Xref corteva/rioxarray#793 * Add spatial_ref coordinate to load_tile_map's doctest output The `write_crs` command will write an extra grid_mapping attribute to the encoding that shows up in the coordinates.
1 parent 9c13eb0 commit 3a32169

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

pygmt/datasets/tile_map.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,10 @@ def load_tile_map(
113113
Frozen({'band': 3, 'y': 256, 'x': 512})
114114
>>> raster.coords # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE
115115
Coordinates:
116-
* band (band) uint8 ... 0 1 2
117-
* y (y) float64 ... -7.081e-10 -7.858e+04 ... -1.996e+07 ...
118-
* x (x) float64 ... -2.004e+07 -1.996e+07 ... 1.996e+07 2.004e+07
116+
* band (band) uint8 ... 0 1 2
117+
* y (y) float64 ... -7.081e-10 -7.858e+04 ... -1.996e+07 -2.004e+07
118+
* x (x) float64 ... -2.004e+07 -1.996e+07 ... 1.996e+07 2.004e+07
119+
spatial_ref int64 ... 0
119120
"""
120121
if not _HAS_CONTEXTILY:
121122
raise ImportError(
@@ -166,6 +167,6 @@ def load_tile_map(
166167

167168
# If rioxarray is installed, set the coordinate reference system
168169
if hasattr(dataarray, "rio"):
169-
dataarray = dataarray.rio.set_crs(input_crs="EPSG:3857")
170+
dataarray = dataarray.rio.write_crs(input_crs="EPSG:3857")
170171

171172
return dataarray

0 commit comments

Comments
 (0)