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
f71c978b
Commit
f71c978b
authored
5 years ago
by
Jeremy M Fee
Browse files
Options
Downloads
Patches
Plain Diff
Split get_delta_from_interval to separate method
parent
7613dfb3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
geomagio/TimeseriesUtility.py
+29
-10
29 additions, 10 deletions
geomagio/TimeseriesUtility.py
with
29 additions
and
10 deletions
geomagio/TimeseriesUtility.py
+
29
−
10
View file @
f71c978b
...
...
@@ -35,16 +35,7 @@ def create_empty_trace(starttime, endtime, observatory,
obspy.core.Trace
trace for the requested channel
"""
if
interval
==
'
tenhertz
'
:
delta
=
0.1
elif
interval
==
'
second
'
:
delta
=
1.
elif
interval
==
'
minute
'
:
delta
=
60.
elif
interval
==
'
hour
'
:
delta
=
3600.
elif
interval
==
'
day
'
:
delta
=
86400.
delta
=
get_delta_from_interval
(
interval
)
stats
=
obspy
.
core
.
Stats
()
stats
.
network
=
network
stats
.
station
=
station
...
...
@@ -62,6 +53,34 @@ def create_empty_trace(starttime, endtime, observatory,
return
obspy
.
core
.
Trace
(
data
,
stats
)
def
get_delta_from_interval
(
data_interval
):
"""
convert interval name to number of seconds
Parameters
----------
interval : str
interval length {day, hour, minute, second, tenhertz}
Returns
-------
int
number of seconds for interval, or None if unknown
"""
if
data_interval
==
'
tenhertz
'
:
delta
=
0.1
elif
data_interval
==
'
second
'
:
delta
=
1.
elif
data_interval
==
'
minute
'
:
delta
=
60.
elif
data_interval
==
'
hour
'
:
delta
=
3600.
elif
data_interval
==
'
day
'
:
delta
=
86400.
else
:
delta
=
None
return
delta
def
get_stream_start_end_times
(
timeseries
,
without_gaps
=
False
):
"""
get start and end times from a stream.
Traverses all traces, and find the earliest starttime, and
...
...
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