Skip to content
Snippets Groups Projects
Commit 5bf95720 authored by Cain, Payton David's avatar Cain, Payton David
Browse files

mseed/edge factories should set type to SNCL type

parent fd912623
No related branches found
No related tags found
2 merge requests!146Release CMO metadata to production,!138Locations as Data Types
......@@ -5,7 +5,7 @@ from geomagio.edge import EdgeFactory
from numpy.testing import assert_equal
def dont_get_timeseries():
def test_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():
......
"""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(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment