Skip to content

Commit 33b66a6

Browse files
author
Matic Lubej
committed
return early if no data
1 parent efa49d4 commit 33b66a6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

eolearn/mask/snow_mask.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ def _apply_dilation(self, snow_masks: np.ndarray) -> np.ndarray:
6666

6767
def execute(self, eopatch: EOPatch) -> EOPatch:
6868
bands = eopatch[self.bands_feature][..., self.band_indices]
69+
if bands.shape[0] == 0:
70+
eopatch[self.mask_feature] = np.zeros((*bands.shape[:-1], 1), dtype=bool)
71+
return eopatch
72+
6973
with np.errstate(divide="ignore", invalid="ignore"):
7074
# (B03 - B11) / (B03 + B11)
7175
ndsi = (bands[..., 0] - bands[..., 3]) / (bands[..., 0] + bands[..., 3])

0 commit comments

Comments
 (0)