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 group_files and from_files utility functions for creating Scenes from multiple files #576

Merged
merged 9 commits into from
Jan 29, 2019

Conversation

djhoese
Copy link
Member

@djhoese djhoese commented Jan 13, 2019

This is partially discussed in #310. Basically when using MultiScene objects or when you want to create a lot of Scenes from an unorganized series of files. I've had to do this "manually" for a lot of the MultiScene examples I've created where doing it requires that I know something about the file pattern. Usually that means knowing when/where the "start_time" field occurs in filenames and grouping files by that time. This PR adds a satpy.readers.group_files utility function to help with this by using a reader's file patterns to figure out the start_time but allow for other fields to be used too.

Additionally, I add a from_files classmethod to MultiScene to use this new group_files method and create a MultiScene. Should I add a classmethod to Scene to do the same (return a list of Scenes)?

I still need to add tests and something in the sphinx docs.

@djhoese djhoese added enhancement code enhancements, features, improvements component:readers component:scene labels Jan 13, 2019
@djhoese djhoese added this to the v0.12 milestone Jan 13, 2019
@djhoese djhoese self-assigned this Jan 13, 2019
@djhoese djhoese requested a review from mraspaud January 13, 2019 15:49
@coveralls
Copy link

coveralls commented Jan 13, 2019

Coverage Status

Coverage increased (+0.3%) to 77.726% when pulling 87d7ac1 on djhoese:feature-group-files into d011adf on pytroll:master.

@codecov
Copy link

codecov bot commented Jan 13, 2019

Codecov Report

Merging #576 into master will increase coverage by 0.28%.
The diff coverage is 96%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #576      +/-   ##
==========================================
+ Coverage   77.44%   77.72%   +0.28%     
==========================================
  Files         136      136              
  Lines       19154    19305     +151     
==========================================
+ Hits        14834    15005     +171     
+ Misses       4320     4300      -20
Impacted Files Coverage Δ
satpy/readers/__init__.py 95.12% <100%> (+0.65%) ⬆️
satpy/tests/test_readers.py 98.41% <100%> (+0.25%) ⬆️
satpy/tests/test_multiscene.py 94.73% <100%> (+0.39%) ⬆️
satpy/multiscene.py 81.13% <84.21%> (+2.01%) ⬆️
satpy/tests/writer_tests/test_geotiff.py 92.64% <0%> (-1.9%) ⬇️
satpy/readers/seviri_l1b_nc.py 17.82% <0%> (-0.63%) ⬇️
satpy/writers/geotiff.py 44.14% <0%> (+0.62%) ⬆️
satpy/tests/reader_tests/test_ahi_hsd.py 96.51% <0%> (+0.79%) ⬆️
satpy/readers/ahi_hsd.py 72.98% <0%> (+11.99%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d011adf...87d7ac1. Read the comment docs.

@djhoese djhoese changed the title [WIP] Add group_files and from_files utility functions for creating Scenes from multiple files Add group_files and from_files utility functions for creating Scenes from multiple files Jan 13, 2019
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

@djhoese djhoese merged commit ea26c9b into pytroll:master Jan 29, 2019
@djhoese djhoese deleted the feature-group-files branch January 29, 2019 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:readers component:scene enhancement code enhancements, features, improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create MultiScene from list of files
3 participants