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 casting and scaling float arrays in finalize #38

Merged
merged 2 commits into from
Dec 20, 2018

Conversation

djhoese
Copy link
Member

@djhoese djhoese commented Dec 20, 2018

Yet another bug found. If you use finalize on an RGBA array represented by floats it wasn't casting it to the output data type which was causing an error by rasterio. Additionally, it wasn't being scaled because it already had an alpha channel.

This should all be fixed now so all float input gets scaled to the output data range regardless of mode and is assumed to be between 0 and 1. All integer input data is left as is and is assumed to be the expected values. Any integer values that don't fit in the output data type are clipped. I've tried adding all this information to the docstring for finalize as well.

  • Tests added (for all bug fixes or enhancements)
  • Tests passed (for all non-documentation changes)
  • Passes git diff origin/master **/*py | flake8 --diff (remove if you did not edit any Python files)
  • Fully documented (remove if this change should not be visible to users, e.g., if it is an internal clean-up, or if this is part of a larger project that will be documented later)

@djhoese djhoese added the bug label Dec 20, 2018
@djhoese djhoese self-assigned this Dec 20, 2018
@coveralls
Copy link

Coverage Status

Coverage increased (+0.1%) to 88.394% when pulling 97d2491 on djhoese:bugfix-rgba-floats into b9ca0e7 on pytroll:master.

@djhoese djhoese merged commit d5e653c into pytroll:master Dec 20, 2018
@djhoese djhoese deleted the bugfix-rgba-floats branch December 20, 2018 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants