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
5bf95720
Commit
5bf95720
authored
3 years ago
by
Cain, Payton David
Browse files
Options
Downloads
Patches
Plain Diff
mseed/edge factories should set type to SNCL type
parent
fd912623
No related branches found
No related tags found
2 merge requests
!146
Release CMO metadata to production
,
!138
Locations as Data Types
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
test/edge_test/EdgeFactory_test.py
+30
-1
30 additions, 1 deletion
test/edge_test/EdgeFactory_test.py
test/edge_test/MiniSeedFactory_test.py
+35
-4
35 additions, 4 deletions
test/edge_test/MiniSeedFactory_test.py
with
65 additions
and
5 deletions
test/edge_test/EdgeFactory_test.py
+
30
−
1
View file @
5bf95720
...
...
@@ -5,7 +5,7 @@ from geomagio.edge import EdgeFactory
from
numpy.testing
import
assert_equal
def
don
t_get_timeseries
():
def
tes
t_get_timeseries
():
"""
edge_test.EdgeFactory_test.test_get_timeseries()
"""
# Call get_timeseries, and test stats for comfirmation that it came back.
# TODO, need to pass in host and port from a config file, or manually
...
...
@@ -29,6 +29,35 @@ def dont_get_timeseries():
"
H
"
,
"
Expect timeseries stats channel to be equal to H
"
,
)
assert_equal
(
timeseries
.
select
(
channel
=
"
H
"
)[
0
].
stats
.
data_type
,
"
variation
"
,
"
Expect timeseries stats data_type to be equal to variation
"
,
)
# timeseries requested with location code as type
timeseries
=
edge_factory
.
get_timeseries
(
UTCDateTime
(
2015
,
3
,
1
,
0
,
0
,
0
),
UTCDateTime
(
2015
,
3
,
1
,
1
,
0
,
0
),
"
BOU
"
,
(
"
H
"
),
"
R0
"
,
"
minute
"
,
)
assert_equal
(
timeseries
.
select
(
channel
=
"
H
"
)[
0
].
stats
.
station
,
"
BOU
"
,
"
Expect timeseries to have stats
"
,
)
assert_equal
(
timeseries
.
select
(
channel
=
"
H
"
)[
0
].
stats
.
channel
,
"
H
"
,
"
Expect timeseries stats channel to be equal to H
"
,
)
assert_equal
(
timeseries
.
select
(
channel
=
"
H
"
)[
0
].
stats
.
data_type
,
"
variation
"
,
"
Expect timeseries stats data_type to be equal to variation
"
,
)
def
test_add_empty_channels
():
...
...
This diff is collapsed.
Click to expand it.
test/edge_test/MiniSeedFactory_test.py
+
35
−
4
View file @
5bf95720
"""
Tests for MiniSeedFactory.py
"""
import
io
from
test.edge_test.conftest
import
MockMiniSeedClient
import
numpy
from
numpy.testing
import
assert_equal
from
obspy.core
import
read
,
Stats
,
Stream
,
Trace
,
UTCDateTime
import
pytest
from
geomagio
import
TimeseriesUtility
from
geomagio.edge
import
MiniSeedFactory
,
MiniSeedInputClient
...
...
@@ -85,14 +87,14 @@ def test__set_metadata():
assert_equal
(
stream
[
1
].
stats
[
"
channel
"
],
"
H
"
)
# def test_get_timeseries():
def
dont_get_timeseries
():
def
test_get_timeseries
(
MockMiniSeedClient
):
"""
edge_test.MiniSeedFactory_test.test_get_timeseries()
"""
# Call get_timeseries, and test stats for comfirmation that it came back.
# TODO, need to pass in host and port from a config file, or manually
# change for a single test.
edge_factory
=
MiniSeedFactory
(
host
=
"
TODO
"
,
port
=
"
TODO
"
)
timeseries
=
edge_factory
.
get_timeseries
(
miniseed_factory
=
MiniSeedFactory
()
miniseed_factory
.
client
=
MockMiniSeedClient
()
timeseries
=
miniseed_factory
.
get_timeseries
(
UTCDateTime
(
2015
,
3
,
1
,
0
,
0
,
0
),
UTCDateTime
(
2015
,
3
,
1
,
1
,
0
,
0
),
"
BOU
"
,
...
...
@@ -110,6 +112,35 @@ def dont_get_timeseries():
"
H
"
,
"
Expect timeseries stats channel to be equal to H
"
,
)
assert_equal
(
timeseries
.
select
(
channel
=
"
H
"
)[
0
].
stats
.
data_type
,
"
variation
"
,
"
Expect timeseries stats data_type to be equal to variation
"
,
)
# timeseries requested with location code as type
timeseries
=
miniseed_factory
.
get_timeseries
(
UTCDateTime
(
2015
,
3
,
1
,
0
,
0
,
0
),
UTCDateTime
(
2015
,
3
,
1
,
1
,
0
,
0
),
"
BOU
"
,
(
"
H
"
),
"
R0
"
,
"
minute
"
,
)
assert_equal
(
timeseries
.
select
(
channel
=
"
H
"
)[
0
].
stats
.
station
,
"
BOU
"
,
"
Expect timeseries to have stats
"
,
)
assert_equal
(
timeseries
.
select
(
channel
=
"
H
"
)[
0
].
stats
.
channel
,
"
H
"
,
"
Expect timeseries stats channel to be equal to H
"
,
)
assert_equal
(
timeseries
.
select
(
channel
=
"
H
"
)[
0
].
stats
.
data_type
,
"
variation
"
,
"
Expect timeseries stats data_type to be equal to variation
"
,
)
def
__create_trace
(
...
...
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