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 Feb 16, 2024
1 parent d04451d commit bbb21d5
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 @@ -860,7 +860,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 bbb21d5

Please sign in to comment.