From 961d4d95c732f4fb183de241e23b7243b012db9c Mon Sep 17 00:00:00 2001 From: Gabe Joseph Date: Wed, 6 Apr 2022 15:43:48 -0400 Subject: [PATCH] Better error when forgetting mosaic custom nodata Inspired by https://github.com/microsoft/PlanetaryComputer/discussions/17#discussioncomment-2517910 --- stackstac/ops.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/stackstac/ops.py b/stackstac/ops.py index adc0f4d..502650e 100644 --- a/stackstac/ops.py +++ b/stackstac/ops.py @@ -202,7 +202,9 @@ def mosaic( if np.isnan(nodata) and arr.dtype.kind in "biu": # Try to catch usage errors forgetting to set `nodata=` raise ValueError( - f"Cannot use {nodata=} when mosaicing a {arr.dtype} array, since {nodata} cannot exist in the array." + "You've probably forgotten to pass a custom `nodata=` argument. " + f"Cannot use {nodata=} (the default) when mosaicing a {arr.dtype} array, " + f"since {nodata} cannot exist in that dtype. " ) func = (