diff --git a/docs/elements.md b/docs/elements.md index ff68b4c9aaab31d8ec85be936ef15f0947801157..d4340c308c55d41c0caed68645d75983e2d853dc 100644 --- a/docs/elements.md +++ b/docs/elements.md @@ -19,7 +19,7 @@ Elements generated by observatories running the Obsrio data acquisition system. - U, V, W - uses instrument metadata from `geomagio.metadata.instrument.InstrumentCalibrations.get_instrument_calibrations` to convert volt+bin to engineering units. + uses instrument metadata from `geomagio.Metadata.get_instrument` to convert volt+bin to engineering units. uses `geomagio.algorithm.FilterAlgorithm` to filter from 10Hz to 1Hz. diff --git a/geomagio/edge/MiniSeedFactory.py b/geomagio/edge/MiniSeedFactory.py index 63bbffe860fb2034a13fc216320a0f6bd22d61d0..54885511baaecc570148e521dd90649055b75e10 100644 --- a/geomagio/edge/MiniSeedFactory.py +++ b/geomagio/edge/MiniSeedFactory.py @@ -20,7 +20,7 @@ from obspy.core import Stats, Stream, Trace, UTCDateTime from .. import ChannelConverter, TimeseriesUtility from ..geomag_types import DataInterval, DataType -from ..metadata.instrument.InstrumentCalibrations import get_instrument_calibrations +from ..metadata.instrument.InstrumentCalibrations import get_instrument from ..TimeseriesFactory import TimeseriesFactory from ..TimeseriesFactoryException import TimeseriesFactoryException from ..ObservatoryMetadata import ObservatoryMetadata @@ -448,7 +448,7 @@ class MiniSeedFactory(TimeseriesFactory): to contain just a single Trace. """ out = Stream() - metadata = get_instrument_calibrations(observatory, starttime, endtime) + metadata = get_instrument(observatory, starttime, endtime) # loop in case request spans different configurations for entry in metadata: entry_endtime = entry["end_time"] diff --git a/geomagio/metadata/instrument/InstrumentCalibrations.py b/geomagio/metadata/instrument/InstrumentCalibrations.py index d3f52a9ad08f473d790ae0ca71533e05f4475093..a4ad6e640eeab86c501745730f7e69c99f8ff8e1 100644 --- a/geomagio/metadata/instrument/InstrumentCalibrations.py +++ b/geomagio/metadata/instrument/InstrumentCalibrations.py @@ -296,7 +296,7 @@ class InstrumentCalibrations: return channels -def get_instrument_calibrations( +def get_instrument( observatory, start_time=None, end_time=None, calibrations=None, metadata_url=None ): """Get instrument metadata diff --git a/test/Metadata_test.py b/test/Metadata_test.py index 141a657c16e8046f9e4df22274891c538d45df26..d56571ac943f7709bad03db2ec16603dd2bd5f5d 100644 --- a/test/Metadata_test.py +++ b/test/Metadata_test.py @@ -1,7 +1,5 @@ from obspy import UTCDateTime -from geomagio.metadata.instrument.InstrumentCalibrations import ( - get_instrument_calibrations, -) +from geomagio.metadata.instrument.InstrumentCalibrations import get_instrument from numpy.testing import assert_equal @@ -28,7 +26,7 @@ TEST_METADATA = [METADATA1, METADATA2, METADATA3] def test_get_instrument_after(): """Request an interval after the last entry, that has start_time None""" - matches = get_instrument_calibrations( + matches = get_instrument( "TST", UTCDateTime("2021-02-02T00:00:00Z"), UTCDateTime("2022-01-02T00:00:00Z"), @@ -39,7 +37,7 @@ def test_get_instrument_after(): def test_get_instrument_before(): """Request an interval before the first entry, that has start_time None""" - matches = get_instrument_calibrations( + matches = get_instrument( "TST", UTCDateTime("2019-02-02T00:00:00Z"), UTCDateTime("2020-01-02T00:00:00Z"), @@ -50,7 +48,7 @@ def test_get_instrument_before(): def test_get_instrument_inside(): """Request an interval that is wholly contained by one entry""" - matches = get_instrument_calibrations( + matches = get_instrument( "TST", UTCDateTime("2020-02-02T01:00:00Z"), UTCDateTime("2020-02-02T02:00:00Z"), @@ -61,7 +59,7 @@ def test_get_instrument_inside(): def test_get_instrument_span(): """Request a time interval that spans multiple entries""" - matches = get_instrument_calibrations( + matches = get_instrument( "TST", UTCDateTime("2020-01-02T00:00:00Z"), UTCDateTime("2020-02-02T01:00:00Z"), @@ -72,7 +70,7 @@ def test_get_instrument_span(): def test_get_instrument_unknown(): """Request an unknown observatory""" - matches = get_instrument_calibrations( + matches = get_instrument( "OTHER", UTCDateTime("2020-01-02T00:00:00Z"), UTCDateTime("2020-02-02T01:00:00Z"), diff --git a/test/edge_test/MiniSeedFactory_test.py b/test/edge_test/MiniSeedFactory_test.py index 75f895e5c8a7a2bb83d0bdbe9215076a52095635..2e9d09526c3a8c9c3112020ad74b93fe8db6b525 100644 --- a/test/edge_test/MiniSeedFactory_test.py +++ b/test/edge_test/MiniSeedFactory_test.py @@ -10,9 +10,7 @@ import pytest from geomagio import TimeseriesUtility from geomagio.edge import MiniSeedFactory, MiniSeedInputClient -from geomagio.metadata.instrument.InstrumentCalibrations import ( - get_instrument_calibrations, -) +from geomagio.metadata.instrument.InstrumentCalibrations import get_instrument from .mseed_test_clients import MockMiniSeedClient, MisalignedMiniSeedClient @@ -46,7 +44,7 @@ def misaligned_miniseed_factory() -> MiniSeedFactory: @pytest.fixture() def bou_u_metadata(): - metadata = get_instrument_calibrations(observatory="BOU") + metadata = get_instrument(observatory="BOU") instrument = metadata[0]["instrument"] channels = instrument["channels"] yield channels["U"]