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

Make it possible to set fill value when reading images #2940

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

pnuu
Copy link
Member

@pnuu pnuu commented Oct 18, 2024

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 #2897 .

@pnuu pnuu added enhancement code enhancements, features, improvements component:readers labels Oct 18, 2024
@pnuu pnuu requested a review from strandgren October 18, 2024 10:40
@pnuu pnuu self-assigned this Oct 18, 2024
@pnuu
Copy link
Member Author

pnuu commented Oct 18, 2024

This is still a very rough draft, so comments are welcome.

Copy link

codecov bot commented Oct 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

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%) ⬇️
unittests 96.19% <100.00%> (-0.03%) ⬇️

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

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 Coverage Status
Change from base Build 11398631499: 0.001%
Covered Lines: 53184
Relevant Lines: 55283

💛 - Coveralls

@strandgren
Copy link
Collaborator

Thanks for working on this, I can confirm that by setting reader_kwargs={"set_fill_value": 255} the issue I originally had in #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.

@djhoese
Copy link
Member

djhoese commented Oct 21, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:readers enhancement code enhancements, features, improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow generic_image reader to set fill value on reading
5 participants