Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
geomag-algorithms
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ghsc
National Geomagnetism Program
geomag-algorithms
Commits
2f574471
Commit
2f574471
authored
9 years ago
by
Hal Simpson
Browse files
Options
Downloads
Patches
Plain Diff
Added function to determine if an algorithm can produce data for the given timerange.
parent
31f42d5e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
geomagio/Algorithm.py
+24
-0
24 additions, 0 deletions
geomagio/Algorithm.py
with
24 additions
and
0 deletions
geomagio/Algorithm.py
+
24
−
0
View file @
2f574471
"""
Algorithm Interface.
"""
import
TimeseriesUtility
class
Algorithm
(
object
):
"""
Base class for geomag algorithms
...
...
@@ -67,3 +69,25 @@ class Algorithm(object):
start and end of required input to generate requested output.
"""
return
(
start
,
end
)
def
can_produce_data
(
self
,
starttime
,
endtime
,
stream
):
"""
Can Product data
Parameters
----------
starttime: UTCDateTime
start time of requested output
end : UTCDateTime
end time of requested output
stream: obspy.core.Stream
The input stream we want to make certain has data for the algorithm
"""
input_gaps
=
TimeseriesUtility
.
get_merged_gaps
(
TimeseriesUtility
.
get_stream_gaps
(
stream
))
for
input_gap
in
input_gaps
:
# Check for gaps that include the entire range
if
(
starttime
>=
input_gap
[
0
]
and
starttime
<=
input_gap
[
1
]
and
endtime
<
input_gap
[
2
]):
return
False
return
True
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment