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
710685ca
Commit
710685ca
authored
10 years ago
by
Hal Simpson
Browse files
Options
Downloads
Patches
Plain Diff
removed unused functions. Moved code out of _set_metadata into the ObservatoryMetadata class.
parent
eac780bc
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/edge/EdgeFactory.py
+34
-83
34 additions, 83 deletions
geomagio/edge/EdgeFactory.py
with
34 additions
and
83 deletions
geomagio/edge/EdgeFactory.py
+
34
−
83
View file @
710685ca
...
...
@@ -60,8 +60,6 @@ class EdgeFactory(TimeseriesFactory):
channel
,
type
,
interval
)
timeseries
+=
data
timeseries
.
merge
()
return
timeseries
def
put_timeseries
(
self
,
starttime
,
endtime
,
observatory
=
None
,
...
...
@@ -96,29 +94,6 @@ class EdgeFactory(TimeseriesFactory):
"""
raise
NotImplementedError
(
'"
put_timeseries
"
not implemented
'
)
def
get_type_from_edge
(
self
,
location
):
"""
Get type from edge location
Parameters
----------
location: {R0, R1, Q0, D0}
the edge location code.
Returns
-------
type: {variation, quasi-definitive, definitive}
the type of data
"""
type
=
None
print
location
if
location
==
'
R0
'
or
location
==
'
R1
'
:
type
=
'
variation
'
elif
location
==
'
Q0
'
:
type
=
'
quasi-definitive
'
elif
location
==
'
D0
'
:
type
=
'
definitive
'
return
type
def
_get_edge_network
(
self
,
observatory
,
channel
,
type
,
interval
):
"""
get edge network code.
...
...
@@ -126,10 +101,10 @@ class EdgeFactory(TimeseriesFactory):
----------
observatory : str
observatory code
channel
s
:
array_like
list of
single character channel
s
{H, E, D, Z, F}
channel :
str
single character channel {H, E, D, Z, F}
type : str
data type {
D
efinitive,
Q
uasi-definitive,
V
ariation}
data type {
d
efinitive,
q
uasi-definitive,
v
ariation}
interval : str
interval length {minute, second}
...
...
@@ -147,10 +122,10 @@ class EdgeFactory(TimeseriesFactory):
----------
observatory : str
observatory code
channel
s
:
array_like
list of
single character channel
s
{H, E, D, Z, F}
channel :
str
single character channel {H, E, D, Z, F}
type : str
data type {
D
efinitive,
Q
uasi-definitive,
V
ariation}
data type {
d
efinitive,
q
uasi-definitive,
v
ariation}
interval : str
interval length {minute, second}
...
...
@@ -168,10 +143,10 @@ class EdgeFactory(TimeseriesFactory):
----------
observatory : str
observatory code
channel
s
:
array_like
list of
single character channel
s
{H, E, D, Z, F}
channel :
str
single character channel {H, E, D, Z, F}
type : str
data type {
D
efinitive,
Q
uasi-definitive,
V
ariation}
data type {
d
efinitive,
q
uasi-definitive,
v
ariation}
interval : str
interval length {minute, second}
...
...
@@ -207,10 +182,10 @@ class EdgeFactory(TimeseriesFactory):
----------
observatory : str
observatory code
channel
s
:
array_like
list of
single character channel
s
{H, E, D, Z, F}
channel :
str
single character channel {H, E, D, Z, F}
type : str
data type {
D
efinitive,
Q
uasi-definitive,
V
ariation}
data type {
d
efinitive,
q
uasi-definitive,
v
ariation}
interval : str
interval length {minute, second}
...
...
@@ -228,37 +203,6 @@ class EdgeFactory(TimeseriesFactory):
location
=
'
D0
'
return
location
def
_get_interval_from_code
(
self
,
interval
):
"""
get interval from edge Code.
The first character of an Edge code represents the interval.
Currently minute and second are represented.
Parameters
----------
observatory : str
observatory code
channels : array_like
list of single character channels {H, E, D, Z, F}
type : str
data type {Definitive, Quasi-definitive, Variation}
interval : str
interval length {minute, second}
Returns
-------
interval type
"""
interval_code
=
None
if
interval
==
'
M
'
:
interval_code
=
'
minute
'
elif
interval
==
'
S
'
:
interval_code
=
'
second
'
else
:
raise
TimeseriesFactoryException
(
'
Unexpected interval code
"
%s
'
%
interval
)
return
interval_code
def
_get_interval_code
(
self
,
interval
):
"""
get edge interval code.
...
...
@@ -269,10 +213,10 @@ class EdgeFactory(TimeseriesFactory):
----------
observatory : str
observatory code
channel
s
:
array_like
list of
single character channel
s
{H, E, D, Z, F}
channel :
str
single character channel {H, E, D, Z, F}
type : str
data type {
D
efinitive,
Q
uasi-definitive,
V
ariation}
data type {
d
efinitive,
q
uasi-definitive,
v
ariation}
interval : str
interval length {minute, second}
...
...
@@ -306,10 +250,10 @@ class EdgeFactory(TimeseriesFactory):
the endtime of the requested data
observatory : str
observatory code
channel
s
:
array_like
list of
single character channel
s
{H, E, D, Z, F}
channel :
str
single character channel {H, E, D, Z, F}
type : str
data type {
D
efinitive,
Q
uasi-definitive,
V
ariation}
data type {
d
efinitive,
q
uasi-definitive,
v
ariation}
interval : str
interval length {minute, second}
...
...
@@ -328,18 +272,25 @@ class EdgeFactory(TimeseriesFactory):
type
,
interval
)
data
=
self
.
client
.
getWaveform
(
network
,
station
,
location
,
edge_channel
,
starttime
,
endtime
)
# stats = obspy.core.Stats(data[0].stats
)
data
.
merge
(
)
self
.
_set_metadata
(
data
,
observatory
,
channel
,
type
,
interval
)
# data[0].stats = stats
return
data
def
_set_metadata
(
self
,
stream
,
observatory
,
channel
,
type
,
interval
):
"""
set metadata for a given stream/channel
"""
print
'
channel
'
print
channel
"""
set metadata for a given stream/channel
Parameters
----------
observatory : str
observatory code
channel : str
edge channel code {MVH, MVE, MVD, ...}
type : str
data type {definitive, quasi-definitive, variation}
interval : str
interval length {minute, second}
"""
for
trace
in
stream
:
trace
.
stats
[
'
channel
'
]
=
channel
trace
.
stats
[
'
data_interval
'
]
=
interval
trace
.
stats
[
'
data_type
'
]
=
type
self
.
observatoryMetadata
.
set_metadata
(
trace
.
stats
,
observatory
)
self
.
observatoryMetadata
.
set_metadata
(
trace
.
stats
,
observatory
,
channel
,
type
,
interval
)
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