Skip to content

Commit 480c671

Browse files
authored
load_tile_map: Fix the raster band indexing, should start from 1 (#3322)
1 parent 3a32169 commit 480c671

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

pygmt/datasets/tile_map.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ 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
116+
* band (band) uint8 ... 1 2 3
117117
* y (y) float64 ... -7.081e-10 -7.858e+04 ... -1.996e+07 -2.004e+07
118118
* x (x) float64 ... -2.004e+07 -1.996e+07 ... 1.996e+07 2.004e+07
119119
spatial_ref int64 ... 0
@@ -122,8 +122,7 @@ def load_tile_map(
122122
raise ImportError(
123123
"Package `contextily` is required to be installed to use this function. "
124124
"Please use `python -m pip install contextily` or "
125-
"`mamba install -c conda-forge contextily` "
126-
"to install the package."
125+
"`mamba install -c conda-forge contextily` to install the package."
127126
)
128127

129128
contextily_kwargs = {}
@@ -158,7 +157,7 @@ def load_tile_map(
158157
dataarray = xr.DataArray(
159158
data=rgb_image,
160159
coords={
161-
"band": np.array(object=[0, 1, 2], dtype=np.uint8), # Red, Green, Blue
160+
"band": np.array(object=[1, 2, 3], dtype=np.uint8), # Red, Green, Blue
162161
"y": np.linspace(start=top, stop=bottom, num=rgb_image.shape[1]),
163162
"x": np.linspace(start=left, stop=right, num=rgb_image.shape[2]),
164163
},

0 commit comments

Comments
 (0)