pytroll / pytroll-collectors

Collector modules for Pytroll
GNU General Public License v3.0
3 stars 18 forks source link

Make it possible to group segments for full minutes #47

Closed pnuu closed 4 years ago

pnuu commented 4 years ago

This PR makes it possible to group segments for given full minutes.

The feature makes it possible to collect e.g. Himawari-8 segments that otherwise would require 6 separate collectors (one for each 10-minute slot), and then would have incorrect time attached for slots not starting at full hour. To configure (see full example in examples/segment_gatherer.ini_template, [himawari-8] section):

pattern = IMG_{platform_name:4s}{channel_name:3s}_{start_time:%Y%m%d%H%M}_{segment:0>3s}
...
group_by_minutes = 10
keep_parsed_keys = start_time

This means that the segments are group for every full 10 minute period. This period can be anything from 1 (group for every full minute) onwards. Values equal or greater than 60 will group the data to full hours.

The last option means that the start_time parsed from the filename is not overwritten by the time given in the incoming message. Any other tags in the pattern can be given in same way.

codecov[bot] commented 4 years ago

Codecov Report

Merging #47 into master will decrease coverage by 0.08%. The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master     #47      +/-   ##
=========================================
- Coverage    4.37%   4.29%   -0.09%     
=========================================
  Files          18      18              
  Lines        2786    2838      +52     
=========================================
  Hits          122     122              
- Misses       2664    2716      +52
Impacted Files Coverage Δ
pytroll_collectors/segments.py 0% <0%> (ø) :arrow_up:
pytroll_collectors/tests/test_segments.py 0% <0%> (ø) :arrow_up:
pytroll_collectors/helper_functions.py 15.88% <0%> (ø) :arrow_up:

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 95dcdbe...49fdd5a. Read the comment docs.

pnuu commented 4 years ago

Tested this with real-time data from Eumetcast. Rather surprisingly works :grin:

TAlonglong commented 4 years ago

As far as I can see this looks good.

pnuu commented 4 years ago

Thanks to @mraspaud for pointing out that the previous solution was pretty convoluted. This should be much easier for the user to understand and configure.

TAlonglong commented 4 years ago

Nice @pnuu !

Could you add some explanation at least in the ini file of the group_by_minutes variable?

pnuu commented 4 years ago

Thanks @TAlonglong! I had also forgotten to adjust the file pattern for the Himawari-8 example config.