Suppress empty 3x3 warning.

This commit is contained in:
Felix Delattre 2026-06-11 12:33:22 +02:00
parent e33256d43d
commit be37c33b18

View file

@ -101,6 +101,7 @@ def _read_center_pixel(path: Path, lat: float, lon: float) -> float | None:
if nodata is not None:
data = np.where(data == nodata, np.nan, data)
data[data == 0] = np.nan
with np.errstate(all="ignore"):
val = np.nanmean(data)
return None if np.isnan(val) else float(val)
except Exception:
@ -310,6 +311,7 @@ def _read_multiband_center(
if nodata is not None:
data = np.where(data == nodata, np.nan, data)
data[data == 0] = np.nan
with np.errstate(all="ignore"):
val = np.nanmean(data)
result[name] = None if np.isnan(val) else round(float(val), 6)
return result