Skip to content

Commit

Permalink
Intervals must include the upper extreme
Browse files Browse the repository at this point in the history
Signed-off-by: João Lucas de Sousa Almeida <[email protected]>
  • Loading branch information
Joao-L-S-Almeida committed Aug 16, 2024
1 parent 3d9b5f5 commit ec8125e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions terratorch/models/backbones/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ def _estimate_in_chans(model_bands: list[HLSBands] | list[str] | tuple[int, int]
is_sublist, requires_special_eval = _are_sublists_of_int(model_bands)

# Bands as intervals limited by integers
# The bands numbering follows the Python convention (starts with 0)
# and includes the extrema (so the +1 in order to include the last band)
if requires_special_eval:

if is_sublist:
in_chans = sum([i[-1] - i[0] for i in model_bands])
in_chans = sum([i[-1] - i[0] + 1 for i in model_bands])
else:
in_chans = model_bands[-1] - model_bands[0]
in_chans = model_bands[-1] - model_bands[0] + 1
else:
in_chans = len(model_bands)

Expand Down

0 comments on commit ec8125e

Please sign in to comment.