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

Add support for fill_value and set_empty_bucket_to in BucketResampler get_sum #602

Merged
merged 11 commits into from
Jul 24, 2024

Conversation

ameraner
Copy link
Member

@ameraner ameraner commented Jun 14, 2024

This PR adds support for fill_value and set_empty_bucket_to in BucketResampler get_sum. This is a nice feature, but most importantly it fixes the satpy bucket_sum interface.

Closes pytroll/satpy#2805, closes pytroll/satpy#1746, closes #354

  • Tests added
  • Tests passed
  • Passes git diff origin/main **/*py | flake8 --diff
  • Fully documented

Copy link

codecov bot commented Jun 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.99%. Comparing base (56f4506) to head (05920a8).
Report is 22 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #602      +/-   ##
==========================================
- Coverage   94.01%   93.99%   -0.03%     
==========================================
  Files          92       86       -6     
  Lines       13836    13782      -54     
==========================================
- Hits        13008    12954      -54     
  Misses        828      828              
Flag Coverage Δ
unittests 93.99% <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

Coverage Status

coverage: 93.69% (+0.01%) from 93.676%
when pulling 512a265 on ameraner:fix_bucket_sum_for_fillvalue
into db94a87 on pytroll:main.

pyresample/bucket/__init__.py Outdated Show resolved Hide resolved
pyresample/bucket/__init__.py Outdated Show resolved Hide resolved
pyresample/bucket/__init__.py Outdated Show resolved Hide resolved
pyresample/test/test_bucket.py Outdated Show resolved Hide resolved
@coveralls
Copy link

Coverage Status

coverage: 93.69% (+0.01%) from 93.676%
when pulling 6fc18c6 on ameraner:fix_bucket_sum_for_fillvalue
into db94a87 on pytroll:main.

@ameraner
Copy link
Member Author

ameraner commented Jul 3, 2024

I addressed all comments, and most importantly I switched all bucket tests to pytest. I realised there are many ways to do this (like do we need a base test class containing all tests?), so please let me know if you like it like this. I also used fixtures with module scope to optimise it a bit.

I also parametrised the get_sum arguments tests into one test as proposed. It took a while to figure out the combination and simplification of the test flow, but indeed I think it improved the test readability, and made the testing of more corner cases much easier. So thanks for pushing me to do it :)

@ameraner ameraner requested a review from djhoese July 3, 2024 13:43
@coveralls
Copy link

Coverage Status

coverage: 93.689% (+0.01%) from 93.676%
when pulling f3acfb4 on ameraner:fix_bucket_sum_for_fillvalue
into db94a87 on pytroll:main.

Copy link
Member

@djhoese djhoese left a comment

Choose a reason for hiding this comment

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

Small suggestions, but otherwise looks good. I'd really like @pnuu to review this given he's the original author (right?).

pyresample/bucket/__init__.py Outdated Show resolved Hide resolved
pyresample/bucket/__init__.py Outdated Show resolved Hide resolved
Copy link
Member

@pnuu pnuu left a comment

Choose a reason for hiding this comment

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

LGTM, just the one nitpick-y change that Dave pointed out.

pyresample/bucket/__init__.py Outdated Show resolved Hide resolved
@djhoese
Copy link
Member

djhoese commented Jul 22, 2024

@ameraner I'd like to make a release soon. Any idea if you'll have time to finish this PR up soon? Looks like it might just be small things left to change. Also, does this PR also close #364?

@djhoese
Copy link
Member

djhoese commented Jul 22, 2024

CC @zxdawn about comparisons to #364

@ameraner
Copy link
Member Author

Hi @djhoese , thanks for the review and the ping, indeed it would be great to have this in the next release. I have pushed the modifications as requested.

I believe it should close the PR, yes, as it implements the prosposed functionalities, even with a better granularity using the fill_value and empty_bucket_value arguments.

@coveralls
Copy link

Coverage Status

coverage: 93.692% (+0.02%) from 93.676%
when pulling 05920a8 on ameraner:fix_bucket_sum_for_fillvalue
into db94a87 on pytroll:main.

@zxdawn
Copy link
Member

zxdawn commented Jul 23, 2024

I agree this can close my old PR because it considers both nan and fill_value. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
5 participants