Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error when loading all patches with windows that have bands at lower resolution #85

Merged
merged 2 commits into from
Nov 14, 2024

Conversation

favyen2
Copy link
Collaborator

@favyen2 favyen2 commented Oct 18, 2024

In rslearn.train.Dataset, load_all_patches means we load all patches of a fixed size that together cover the window. This means sometimes the patches can be close to the border of the window, e.g. if window bounds is [0, 0, 257, 257] with 256x256 patch size then one patch would be [256, 256, 512, 512]. This is fine but if there's a lower resolution band (negative zoom offset) it could end up being out of bounds.

Previously the GeotiffRasterFormat retuned None if it is out of bounds for some reason, so this just fixes it to return a zero-valued array of the appropriate # bands and dtype.

…wer resolution.

In rslearn.train.Dataset, load_all_patches means we load all patches of a fixed size
that together cover the window. This means sometimes the patches can be close to the
border of the window, e.g. if window bounds is [0, 0, 257, 257] with 256x256 patch
size then one patch would be [256, 256, 512, 512]. This is fine but if there's a
lower resolution band (negative zoom offset) it could end up being out of bounds.

Previously the GeotiffRasterFormat retuned None if it is out of bounds for some
reason, so this just fixes it to return a zero-valued array of the appropriate #
bands and dtype.
Copy link
Collaborator

@yawenzzzz yawenzzzz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@favyen2 favyen2 merged commit 3140a58 into master Nov 14, 2024
4 checks passed
@favyen2 favyen2 deleted the favyen/20241018-fix-geotiff-raster branch November 14, 2024 02:07
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