Suppress empty 3x3 warning.
This commit is contained in:
parent
e33256d43d
commit
be37c33b18
1 changed files with 4 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue