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 option to choose start time to MSI SAFE reader #2776

Merged
merged 18 commits into from May 13, 2024

Conversation

simonrp84
Copy link
Member

@simonrp84 simonrp84 commented Apr 7, 2024

Currently, the msi_safe reader uses the filename_info to get the start_time for a Scene. This can be problematic as multiple tiles can have the same start_time and will hence overwrite each other:

for files in [[tile1_files], [tile2_files]]:
   scn = Scene(files, reader='msi_safe')
   scn.load(['true_color'])
   scn.save_dataset('true_color')

The user would expect that two images are produced from this, one from each set of files. However, in many cases the second tile will overwrite the image saved by the first.

This PR attempts to fix the problem by allowing an optional reader_kwarg that allows the user to specify that the start_time should be read from the tile metadata rather than the filename:

for files in [[tile1_files], [tile2_files]]:
   scn = Scene(files, reader='msi_safe', reader_kwargs={'use_tile_time': True})
   scn.load(['true_color'])
   scn.save_dataset('true_color')

This will generate two output images as expected.

  • Tests added
  • Fully documented

Copy link

codecov bot commented Apr 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.57%. Comparing base (1742616) to head (3aea6ea).
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2776      +/-   ##
==========================================
- Coverage   95.95%   94.57%   -1.38%     
==========================================
  Files         379      379              
  Lines       53861    53876      +15     
==========================================
- Hits        51680    50952     -728     
- Misses       2181     2924     +743     
Flag Coverage Δ
behaviourtests 4.09% <0.00%> (-0.01%) ⬇️
unittests 95.16% <100.00%> (-0.89%) ⬇️

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 Apr 7, 2024

Pull Request Test Coverage Report for Build 9020466876

Details

  • 18 of 18 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.003%) to 96.032%

Totals Coverage Status
Change from base Build 9020304102: 0.003%
Covered Lines: 51568
Relevant Lines: 53699

💛 - Coveralls

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, thanks for adding this functionality.

@mraspaud mraspaud added enhancement code enhancements, features, improvements component:readers labels Apr 17, 2024
@mraspaud mraspaud added this to the v0.48.0 milestone Apr 17, 2024
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 36f49f3 into pytroll:main May 13, 2024
17 of 19 checks passed
@mraspaud mraspaud removed this from the v0.48.0 milestone May 13, 2024
@mraspaud mraspaud added this to the v0.49.0 milestone May 13, 2024
@simonrp84 simonrp84 deleted the msi_l2 branch May 13, 2024 14:49
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.

None yet

3 participants