Skip to content

Commit 100d682

Browse files
authored
Better error when forgetting mosaic custom nodata (#144)
Inspired by microsoft/PlanetaryComputer#17 (reply in thread)
1 parent a1816bc commit 100d682

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

stackstac/ops.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,9 @@ def mosaic(
202202
if np.isnan(nodata) and arr.dtype.kind in "biu":
203203
# Try to catch usage errors forgetting to set `nodata=`
204204
raise ValueError(
205-
f"Cannot use {nodata=} when mosaicing a {arr.dtype} array, since {nodata} cannot exist in the array."
205+
"You've probably forgotten to pass a custom `nodata=` argument. "
206+
f"Cannot use {nodata=} (the default) when mosaicing a {arr.dtype} array, "
207+
f"since {nodata} cannot exist in that dtype. "
206208
)
207209

208210
func = (

0 commit comments

Comments
 (0)