Skip to content

Commit

Permalink
return early if no data
Browse files Browse the repository at this point in the history
  • Loading branch information
Matic Lubej committed Jun 12, 2024
1 parent efa49d4 commit 33b66a6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions eolearn/mask/snow_mask.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ def _apply_dilation(self, snow_masks: np.ndarray) -> np.ndarray:

def execute(self, eopatch: EOPatch) -> EOPatch:
bands = eopatch[self.bands_feature][..., self.band_indices]
if bands.shape[0] == 0:
eopatch[self.mask_feature] = np.zeros((*bands.shape[:-1], 1), dtype=bool)
return eopatch

with np.errstate(divide="ignore", invalid="ignore"):
# (B03 - B11) / (B03 + B11)
ndsi = (bands[..., 0] - bands[..., 3]) / (bands[..., 0] + bands[..., 3])
Expand Down

0 comments on commit 33b66a6

Please sign in to comment.