Skip to content

Fix band check bug in split_raster and typo fixes#1301

Open
abhayrajjais01 wants to merge 1 commit intoweecology:mainfrom
abhayrajjais01:fix/preprocess-band-check-and-typos
Open

Fix band check bug in split_raster and typo fixes#1301
abhayrajjais01 wants to merge 1 commit intoweecology:mainfrom
abhayrajjais01:fix/preprocess-band-check-and-typos

Conversation

@abhayrajjais01
Copy link
Contributor

  • Fix bug in preprocess.py where band count check used shape[2] (width) instead of shape[0] (channels) after transposing to channels-first format
  • Fix typo 'prediciton' -> 'prediction' in evaluate.py docstring
  • Fix typo 'prediciton' -> 'prediction' in predict.py comment

Description

band check was reading width instead of channels after transpose

- Fix bug in preprocess.py where band count check used shape[2] (width)
  instead of shape[0] (channels) after transposing to channels-first format
- Fix typo 'prediciton' -> 'prediction' in evaluate.py docstring
- Fix typo 'prediciton' -> 'prediction' in predict.py comment
@abhayrajjais01 abhayrajjais01 force-pushed the fix/preprocess-band-check-and-typos branch from b9588a2 to b391811 Compare February 13, 2026 05:45
@codecov
Copy link

codecov bot commented Feb 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.16%. Comparing base (3146b96) to head (b391811).
⚠️ Report is 17 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1301      +/-   ##
==========================================
- Coverage   87.89%   87.16%   -0.74%     
==========================================
  Files          20       21       +1     
  Lines        2776     2851      +75     
==========================================
+ Hits         2440     2485      +45     
- Misses        336      366      +30     
Flag Coverage Δ
unittests 87.16% <100.00%> (-0.74%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@henrykironde
Copy link
Contributor

@abhayrajjais01, thank you for the PR. We need a bit more information to properly document this patch and the findings. Could you please let us know how you discovered this bug, specifically which scripts or functions you were running at the time?

@abhayrajjais01
Copy link
Contributor Author

I found this while reading the split_raster function to understand how numpy images are validated. After transpose(2, 0, 1) converts (H, W, C) to (C, H, W), line 210 reads shape[2] which is now the width dimension. For a 400×400×3 image, bands = 400, the warning fires incorrectly, and numpy_image[:3, :, :] selects 3 rows rather than 3 channels. I also noticed that if shape[2] is not in [3, 4] (like 5-band input), the image is not transposed, but [:3, :, :] still runs on a channels-last array
would you like me to address this in a follow-up?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants