diff --git a/geomagio/api/ws/data.py b/geomagio/api/ws/data.py index c2bc92274c2fca1a9df5b914f81f63fb362ec65f..47971b277fa5fc801622678cd2547c0dedba3e30 100644 --- a/geomagio/api/ws/data.py +++ b/geomagio/api/ws/data.py @@ -40,16 +40,17 @@ def get_data_factory( factory = FDSNFactory(network=observatory.network, locationCode="40") elif sampling_period in [ SamplingPeriod.TEN_HERTZ, - SamplingPeriod.HOUR, - SamplingPeriod.DAY, ]: + # MiniSeedFactory required for floating point data; + # MiniSeedFactory advised for 10 Hz sampling in general factory = MiniSeedFactory( - host=host, port=int(os.getenv("DATA_MINISEED_PORT", "2061")) - ) - elif sampling_period in [SamplingPeriod.SECOND, SamplingPeriod.MINUTE]: - factory = EdgeFactory( - host=host, port=int(os.getenv("DATA_EARTHWORM_PORT", "2060")) + host=host, + port=os.getenv("DATA_MINISEED_PORT", None), + convert_channels=["U", "V", "W"], # no channel mapping (e.g., "H"->"U") ) + elif sampling_period in list(SamplingPeriod): + # EdgeFactory required for real time data with long sample periods + factory = EdgeFactory(host=host, port=os.getenv("DATA_EARTHWORM_PORT", None)) else: return None return DerivedTimeseriesFactory(factory)