diff --git a/geomagio/api/ws/DataApiQuery.py b/geomagio/api/ws/DataApiQuery.py index 8202c6b6e5b0b7ada151adb91602aacfb62e57c1..af1c3f73ff3fc880cc75df45cad2bc20240225f8 100644 --- a/geomagio/api/ws/DataApiQuery.py +++ b/geomagio/api/ws/DataApiQuery.py @@ -39,13 +39,6 @@ class SamplingPeriod(float, enum.Enum): HOUR = 3600.0 DAY = 86400.0 - @property - def input_factory(self): - if self in [SamplingPeriod.TEN_HERTZ, SamplingPeriod.HOUR, SamplingPeriod.DAY]: - return "miniseed" - else: - return "edge" - class DataApiQuery(BaseModel): id: str diff --git a/geomagio/api/ws/data.py b/geomagio/api/ws/data.py index 797e382cd4d75c26d3ce3763659a25c3adbd7eaa..374ca754b626805b9613f3ce47ee5ec9f681b7c1 100644 --- a/geomagio/api/ws/data.py +++ b/geomagio/api/ws/data.py @@ -29,13 +29,15 @@ def get_data_factory( Edge or miniseed factory object """ host = os.getenv("DATA_HOST", "cwbpub.cr.usgs.gov") - factory = query.sampling_period.input_factory - if factory == "edge": - return EdgeFactory(host=host, port=os.getenv("DATA_EARTHWORM_PORT", "2060")) - elif factory == "miniseed": + sampling_period = query.sampling_period + if sampling_period in [ + SamplingPeriod.TEN_HERTZ, + SamplingPeriod.HOUR, + SamplingPeriod.DAY, + ]: return MiniSeedFactory(host=host, port=os.getenv("DATA_MINISEED_PORT", "2061")) else: - return None + return EdgeFactory(host=host, port=os.getenv("DATA_EARTHWORM_PORT", "2060")) def get_data_query(