Fix Scene crop so new areas are consistent with resolution #406
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As described in #336, there are cases when the crop method can produce undesired results. If
crop
is used before resampling (a perfectly valid use case) and the input datasets are made up of different resolutions then the resulting areas would each have different shapes/dimensions. Or at least they could. This PR makes them always cover the same geographic area.I'm not happy with the solution I had to end up with but it works for my simple test cases with ABI so far. I was hoping I could come up with one area definition for the lowest resolution area and use that as the target area for the other croppings. Due to floating point issues and other "rounding"/fudging the results aren't consistent. My solution simply multiplies the slicing indexes by a certain factor assuming that the input datasets are all a round factor of each other (1x, 2x, 4x). Due to the rounding issues in pyresample I'm not sure there is a better solution but welcome other ideas.
I still need to add tests for these specific cases.
git diff origin/master **/*py | flake8 --diff