Make it possible to set fill value when reading images
This PR makes it possible to set fill value when reading for LA and RGBA images with generic_image reader. When this is done, the A band is dropped. Previously RGBA images were converted to float, which caused problems in https://github.com/pytroll/satpy/issues/2897 .
- [x] Closes #2928
- [x] Tests added
- [ ] Fully documented
This is still a very rough draft, so comments are welcome.
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 96.09%. Comparing base (
d62b5d2) to head (6aec8e2). Report is 6 commits behind head on main.
Additional details and impacted files
@@ Coverage Diff @@
## main #2940 +/- ##
==========================================
- Coverage 96.11% 96.09% -0.03%
==========================================
Files 377 377
Lines 55067 55090 +23
==========================================
+ Hits 52929 52940 +11
- Misses 2138 2150 +12
| Flag | Coverage Δ | |
|---|---|---|
| behaviourtests | 3.94% <0.00%> (-0.01%) |
:arrow_down: |
| unittests | 96.19% <100.00%> (-0.03%) |
:arrow_down: |
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Pull Request Test Coverage Report for Build 11402206297
Details
- 30 of 30 (100.0%) changed or added relevant lines in 2 files are covered.
- No unchanged relevant lines lost coverage.
- Overall coverage increased (+0.001%) to 96.203%
| Totals | |
|---|---|
| Change from base Build 11398631499: | 0.001% |
| Covered Lines: | 53184 |
| Relevant Lines: | 55283 |
💛 - Coveralls
Thanks for working on this, I can confirm that by setting reader_kwargs={"set_fill_value": 255} the issue I originally had in https://github.com/pytroll/satpy/issues/2897 is resolved :)
Would it be possible though to read a PNG image with alpha channel and store it again with Scene.save_datasets and retain the alpha channel? So far I have not found a way.
set_fill_value -> fill_value?
Seems odd to me to have a verb in a variable name. Then again I am probably guilty of doing use_x_feature=True or filter_x=True. But in this case the action you're doing is the variable you're specifying.