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 dtype promotion in channel inversion #186

Merged
merged 4 commits into from
Oct 14, 2024

Conversation

pnuu
Copy link
Member

@pnuu pnuu commented Oct 10, 2024

The XRImage.invert() promotes data to float64 when inversion parameters are given for each channel separately. The dtype was tested only for single inversion parameter case, not when they were given for each channel.

This PR splits the test case into two and adds the dtype check also for the per-channel case. And fixes the issue.

  • Closes #xxxx (remove if there is no corresponding issue, which should only be the case for minor changes)
  • 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)

@pnuu pnuu added the bug label Oct 10, 2024
@pnuu pnuu self-assigned this Oct 10, 2024
Copy link

codecov bot commented Oct 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.57%. Comparing base (f0d8d4c) to head (2ce875e).
Report is 18 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #186      +/-   ##
==========================================
+ Coverage   91.54%   91.57%   +0.02%     
==========================================
  Files          11       11              
  Lines        4071     4081      +10     
==========================================
+ Hits         3727     3737      +10     
  Misses        344      344              
Flag Coverage Δ
unittests 91.57% <100.00%> (+0.02%) ⬆️

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.

@coveralls
Copy link

coveralls commented Oct 10, 2024

Coverage Status

coverage: 91.816% (+0.008%) from 91.808%
when pulling 2ce875e on pnuu:bugfix-invert-dtype-promotion
into c384f5b on pytroll:main.

@pnuu pnuu requested review from mraspaud and djhoese October 10, 2024 12:52
Copy link
Member

@mraspaud mraspaud left a comment

Choose a reason for hiding this comment

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

Just a couple of questions, probably because I have not really understood everything

trollimage/tests/test_image.py Show resolved Hide resolved
trollimage/xrimage.py Outdated Show resolved Hide resolved
@pnuu
Copy link
Member Author

pnuu commented Oct 14, 2024

Pushed two more commits to fix the issues in the comments.

Copy link
Member

@mraspaud mraspaud left a comment

Choose a reason for hiding this comment

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

LGTM!

@mraspaud mraspaud merged commit 81b80e2 into pytroll:main Oct 14, 2024
26 checks passed
@pnuu pnuu deleted the bugfix-invert-dtype-promotion branch October 14, 2024 13:03
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.

4 participants