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
f3353407
Commit
f3353407
authored
10 years ago
by
Jeremy M Fee
Browse files
Options
Downloads
Patches
Plain Diff
Update TimeseriesFactory interface to support defaults via constructor
parent
c7f178ed
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
src/python/geomag/io/TimeseriesFactory.py
+52
-12
52 additions, 12 deletions
src/python/geomag/io/TimeseriesFactory.py
with
52 additions
and
12 deletions
src/python/geomag/io/TimeseriesFactory.py
+
52
−
12
View file @
f3353407
...
@@ -2,11 +2,31 @@
...
@@ -2,11 +2,31 @@
class
TimeseriesFactory
(
object
):
class
TimeseriesFactory
(
object
):
"""
Base class for timeseries factories.
"""
"""
Base class for timeseries factories.
def
get_timeseries
(
self
,
observatory
,
starttime
,
endtime
,
Attributes
channels
=
(
'
H
'
,
'
D
'
,
'
Z
'
,
'
F
'
),
----------
observatory : str
default observatory code, usually 3 characters.
channels : array_like
default list of channels to load, optional.
default (
'
H
'
,
'
D
'
,
'
Z
'
,
'
F
'
)
type : {
'
definitive
'
,
'
provisional
'
,
'
quasi-definitive
'
,
'
variation
'
}
default data type, optional.
default
'
variation
'
.
interval : {
'
daily
'
,
'
hourly
'
,
'
minute
'
,
'
monthly
'
,
'
second
'
}
data interval, optional.
default
'
minute
'
.
"""
def
__init__
(
self
,
observatory
=
None
,
channels
=
(
'
H
'
,
'
D
'
,
'
Z
'
,
'
F
'
),
type
=
'
variation
'
,
interval
=
'
minute
'
):
type
=
'
variation
'
,
interval
=
'
minute
'
):
self
.
observatory
=
observatory
self
.
channels
=
channels
self
.
type
=
type
self
.
interval
=
interval
def
get_timeseries
(
self
,
starttime
,
endtime
,
observatory
=
None
,
channels
=
None
,
type
=
None
,
interval
=
None
):
"""
Get timeseries data.
"""
Get timeseries data.
Support for specific channels, types, and intervals varies
Support for specific channels, types, and intervals varies
...
@@ -16,18 +36,22 @@ class TimeseriesFactory(object):
...
@@ -16,18 +36,22 @@ class TimeseriesFactory(object):
Parameters
Parameters
----------
----------
observatory : str
observatory code, usually 3 characters.
starttime : UTCDateTime
starttime : UTCDateTime
time of first sample in timeseries.
time of first sample in timeseries.
endtime : UTCDateTime
endtime : UTCDateTime
time of last sample in timeseries.
time of last sample in timeseries.
observatory : str
observatory code, usually 3 characters, optional.
uses default if unspecified.
channels : array_like
channels : array_like
list of channels to load.
list of channels to load, optional.
uses default if unspecified.
type : {
'
definitive
'
,
'
provisional
'
,
'
quasi-definitive
'
,
'
variation
'
}
type : {
'
definitive
'
,
'
provisional
'
,
'
quasi-definitive
'
,
'
variation
'
}
data type.
data type, optional.
uses default if unspecified.
interval : {
'
daily
'
,
'
hourly
'
,
'
minute
'
,
'
monthly
'
,
'
second
'
}
interval : {
'
daily
'
,
'
hourly
'
,
'
minute
'
,
'
monthly
'
,
'
second
'
}
data interval.
data interval, optional.
uses default if unspecified.
Returns
Returns
-------
-------
...
@@ -41,16 +65,32 @@ class TimeseriesFactory(object):
...
@@ -41,16 +65,32 @@ class TimeseriesFactory(object):
"""
"""
raise
NotImplementedError
(
'"
get_timeseries
"
not implemented
'
)
raise
NotImplementedError
(
'"
get_timeseries
"
not implemented
'
)
def
put_timeseries
(
self
,
timeseries
,
channels
):
def
put_timeseries
(
self
,
timeseries
,
starttime
=
None
,
endtime
=
None
,
observatory
=
None
,
channels
=
None
,
type
=
None
,
interval
=
None
):
"""
Store timeseries data.
"""
Store timeseries data.
Parameters
Parameters
----------
----------
timeseries : obspy.core.Stream
timeseries : obspy.core.Stream
stream containing traces to store.
stream containing traces to store.
channels : list
starttime : UTCDateTime
list of channels to store.
time of first sample in timeseries to store.
uses first sample if unspecified.
endtime : UTCDateTime
time of last sample in timeseries to store.
uses last sample if unspecified.
observatory : str
observatory code, usually 3 characters, optional.
uses default if unspecified.
channels : array_like
list of channels to store, optional.
uses default if unspecified.
type : {
'
definitive
'
,
'
provisional
'
,
'
quasi-definitive
'
,
'
variation
'
}
data type, optional.
uses default if unspecified.
interval : {
'
daily
'
,
'
hourly
'
,
'
minute
'
,
'
monthly
'
,
'
second
'
}
data interval, optional.
uses default if unspecified.
Raises
Raises
------
------
TimeseriesFactoryException
TimeseriesFactoryException
...
...
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