satpy icon indicating copy to clipboard operation
satpy copied to clipboard

Refactor enhancements

Open pnuu opened this issue 6 months ago • 3 comments

This PR continues with the tasks listed in https://github.com/pytroll/satpy/issues/3123 to split __init__.py of subpackages to modules by refactoring enhancements.

  • [x] Tests added
  • [x] Fully documented

pnuu avatar Jun 19 '25 11:06 pnuu

Codecov Report

:x: Patch coverage is 99.39668% with 4 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 96.32%. Comparing base (1670af4) to head (1b3c974). :warning: Report is 212 commits behind head on main.

Files with missing lines Patch % Lines
satpy/enhancements/__init__.py 88.88% 1 Missing :warning:
satpy/enhancements/colormap.py 98.70% 1 Missing :warning:
satpy/enhancements/contrast.py 98.70% 1 Missing :warning:
satpy/tests/enhancement_tests/test_wrappers.py 98.11% 1 Missing :warning:
Additional details and impacted files
@@           Coverage Diff            @@
##             main    #3155    +/-   ##
========================================
  Coverage   96.31%   96.32%            
========================================
  Files         454      465    +11     
  Lines       58045    58159   +114     
========================================
+ Hits        55907    56020   +113     
- Misses       2138     2139     +1     
Flag Coverage Δ
behaviourtests 3.64% <15.38%> (+0.04%) :arrow_up:
unittests 96.41% <99.39%> (+<0.01%) :arrow_up:

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.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Jun 19 '25 11:06 codecov[bot]

Pull Request Test Coverage Report for Build 16820250408

Details

  • 672 of 677 (99.26%) changed or added relevant lines in 17 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.005%) to 96.422%

Changes Missing Coverage Covered Lines Changed/Added Lines %
satpy/enhancements/init.py 9 10 90.0%
satpy/enhancements/colormap.py 77 78 98.72%
satpy/tests/enhancement_tests/test_wrappers.py 53 54 98.15%
satpy/enhancements/contrast.py 78 80 97.5%
<!-- Total: 672 677
Totals Coverage Status
Change from base Build 16807860351: 0.005%
Covered Lines: 56347
Relevant Lines: 58438

💛 - Coveralls

coveralls avatar Jun 19 '25 12:06 coveralls

No warnings from the doc build with the -n in Makefile.

pnuu avatar Jun 19 '25 12:06 pnuu

I renamed stretching.py to contrast.py and color_mapping.py to colormap.py, so they have more consistent naming with the other modules.

pnuu avatar Jun 24 '25 11:06 pnuu

Thanks for the review, I'll have a closer look tomorrow of the two remaining comments when I'm at the work laptop and a bigger screen.

I went with contrast as that's what all the functions in the module adjust. Well, it's debatable if invert() does that...

pnuu avatar Jun 25 '25 17:06 pnuu

I moved trollimage.colormap.Colormap imports to the functions using it in enhancements/colormap.py. Yeah, I know that it is expected it is imported at the module level seeing the name of the module, but the lookup() enhancement doesn't need it so thought it might help in some very edgy use-cases to reduce the footprint.

pnuu avatar Jun 26 '25 11:06 pnuu

Fixed the conflicts from https://github.com/pytroll/satpy/commit/562ac1ebd580550ba93c46e6eb438cc9e273632e

pnuu avatar Aug 07 '25 10:08 pnuu