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
9efa6467
"git@code.usgs.gov:water/dataRetrieval.git" did not exist on "1378d0740896e4180b7f3d9d853ccd4c7478eda5"
Commit
9efa6467
authored
9 years ago
by
Hal Simpson
Browse files
Options
Downloads
Patches
Plain Diff
refactored check_stream to use class variables for channel, and call from process
parent
339609bc
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/XYZAlgorithm.py
+6
-5
6 additions, 5 deletions
geomagio/XYZAlgorithm.py
with
6 additions
and
5 deletions
geomagio/XYZAlgorithm.py
+
6
−
5
View file @
9efa6467
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
"""
"""
from
Algorithm
import
Algorithm
from
Algorithm
import
Algorithm
from
AlgorithmException
import
AlgorithmException
import
StreamConverter
as
StreamConverter
import
StreamConverter
as
StreamConverter
# List of channels by geomagnetic observatory orientation.
# List of channels by geomagnetic observatory orientation.
...
@@ -38,7 +39,7 @@ class XYZAlgorithm(Algorithm):
...
@@ -38,7 +39,7 @@ class XYZAlgorithm(Algorithm):
self
.
informat
=
informat
self
.
informat
=
informat
self
.
outformat
=
outformat
self
.
outformat
=
outformat
def
check_stream
(
self
,
timeseries
,
channels
):
def
check_stream
(
self
,
timeseries
):
"""
checks an stream to make certain all the required channels
"""
checks an stream to make certain all the required channels
exist.
exist.
...
@@ -49,11 +50,10 @@ class XYZAlgorithm(Algorithm):
...
@@ -49,11 +50,10 @@ class XYZAlgorithm(Algorithm):
channels: array_like
channels: array_like
channels that are expected in stream.
channels that are expected in stream.
"""
"""
for
channel
in
channels
:
for
channel
in
self
.
_in
channels
:
if
len
(
timeseries
.
select
(
channel
=
channel
))
==
0
:
if
len
(
timeseries
.
select
(
channel
=
channel
))
==
0
:
print
'
Channel %s not found in input
'
%
channel
raise
AlgorithmException
(
return
False
'
Channel %s not found in input
'
%
channel
)
return
True
def
process
(
self
,
timeseries
):
def
process
(
self
,
timeseries
):
"""
converts a timeseries stream into a different coordinate system
"""
converts a timeseries stream into a different coordinate system
...
@@ -67,6 +67,7 @@ class XYZAlgorithm(Algorithm):
...
@@ -67,6 +67,7 @@ class XYZAlgorithm(Algorithm):
out_stream: obspy.core.Stream
out_stream: obspy.core.Stream
new stream object containing the converted coordinates.
new stream object containing the converted coordinates.
"""
"""
self
.
check_stream
(
timeseries
)
out_stream
=
None
out_stream
=
None
if
self
.
outformat
==
'
geo
'
:
if
self
.
outformat
==
'
geo
'
:
if
self
.
informat
==
'
geo
'
:
if
self
.
informat
==
'
geo
'
:
...
...
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