Skip to content
Snippets Groups Projects
Commit 7fe5eb97 authored by Erin (Josh) Rigler's avatar Erin (Josh) Rigler
Browse files

Merge branch 'fixes_for_AverageAlgorithm_20221207' into 'master'

Fixes for AverageAlgorithm - 20221207

See merge request !202
parents b7a146f7 e1669bb1
No related branches found
No related tags found
1 merge request!202Fixes for AverageAlgorithm - 20221207
Pipeline #202340 failed
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
"name": "geomag-algorithms", "name": "geomag-algorithms",
"organization": "U.S. Geological Survey", "organization": "U.S. Geological Survey",
"description": "Library for processing Geomagnetic timeseries data.", "description": "Library for processing Geomagnetic timeseries data.",
"version": "1.6.1", "version": "1.6.2",
"status": "Development", "status": "Development",
"permissions": { "permissions": {
"usageType": "openSource", "usageType": "openSource",
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
"email": "gs-haz_dev_team_group@usgs.gov" "email": "gs-haz_dev_team_group@usgs.gov"
}, },
"date": { "date": {
"metadataLastUpdated": "2022-11-29" "metadataLastUpdated": "2022-12-07"
} }
} }
] ]
\ No newline at end of file
...@@ -388,17 +388,20 @@ def has_any_channels(stream, channels, starttime, endtime): ...@@ -388,17 +388,20 @@ def has_any_channels(stream, channels, starttime, endtime):
bool: True if any data found between starttime/endtime bool: True if any data found between starttime/endtime
""" """
# process if any channels have data not covering the time range # process if any channels have data not covering the time range
input_gaps = get_stream_gaps(stream=stream, channels=channels) for trace in stream:
for channel in channels: if trace.stats.channel in channels:
if channel not in input_gaps: gaps = get_trace_gaps(trace)
continue if len(gaps) == 0:
channel_gaps = input_gaps[channel] # no gaps in trace;
if len(channel_gaps) == 0: # "any" critierion achieved for stream
# no gaps in channel return True
return True nodata = [
for gap in channel_gaps: (starttime >= gap[0] and starttime <= gap[1] and endtime < gap[2])
if not (starttime >= gap[0] and starttime <= gap[1] and endtime < gap[2]): for gap in gaps
# gap doesn't span channel ]
if not any(nodata):
# no gaps in trace span interval;
# "any" criterion achieved for stream
return True return True
# didn't find any data # didn't find any data
return False return False
......
...@@ -287,4 +287,5 @@ class AverageAlgorithm(Algorithm): ...@@ -287,4 +287,5 @@ class AverageAlgorithm(Algorithm):
# the most recent interval should NOT allow fewer than the full # the most recent interval should NOT allow fewer than the full
# complement of inputs in order to calculate an average (previous # complement of inputs in order to calculate an average (previous
# "update" intervals will allow fewer than the full complement) # "update" intervals will allow fewer than the full complement)
self.min_count_end = arguments.starttime delta = TimeseriesUtility.get_delta_from_interval(arguments.interval)
self.min_count_end = arguments.starttime - delta
This diff is collapsed.
...@@ -17,7 +17,7 @@ packages = [ ...@@ -17,7 +17,7 @@ packages = [
{include = "geomagio" } {include = "geomagio" }
] ]
repository="https://code.usgs.gov/ghsc/geomag/geomag-algorithms" repository="https://code.usgs.gov/ghsc/geomag/geomag-algorithms"
version = "1.6.1" version = "1.6.2"
[tool.poetry.dependencies] [tool.poetry.dependencies]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment