Skip to content

Commit

Permalink
Add missing check for masks dimension
Browse files Browse the repository at this point in the history
  • Loading branch information
adriantre committed Aug 12, 2024
1 parent 9102520 commit 0e015a0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion torchgeo/datasets/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,9 @@ def valid_data_footprint_from_datasource(
# Read valid/nodata-mask. Could choose only the first bands mask for peed-up.
# Currently supports spatial shifts between the bands, and include all of this
# as one combined mask.
mask = np.logical_or(*src.read_masks()[:, ...])
mask = src.read_masks()
if len(mask) > 1:
mask = np.logical_or(*mask[:, ...])
# Close eventual holes within the raster that have area smaller than 500 pixels.
# Yields two bands, one all-zero representing nodata pixels,
# the other representing valid data
Expand Down

0 comments on commit 0e015a0

Please sign in to comment.