Update imagewriter.py with tile and coordinate checks and corrections #65
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 discussed with multiple people from our group the wrapped ASAP image writer sometimes exhibits unexaplainable behaviour that is very hard to debug. In this PR I intend to prevent some of the obvious mistakes to pass without errors. If possible I correct the tile. By doing this the writer becomes more robust and guides the user on what to fix, instead of ambiguously trying to keep the loop going without throwing warnings or errors.
I think the _crop_tile function and the _get_row_col function already partly do some of these checks, but neither throw errors or warnings, causign outputs that are incorrect and leaving users unaware of what went wrong. I left them in right now though, the new function takes care of possible errors.
I havent tested this yet but I would like to share this already so we can finalize it together.
@martvanrijthoven @daangeijs @carlijnlems @nfsuysal @leandervaneekelen @rolandnemeth000