Skip to content
Snippets Groups Projects
Commit b57f6d66 authored by Jeremy M Fee's avatar Jeremy M Fee
Browse files

Merge branch 'issue-8' into 'master'

WS Factory from Sampling Period

Closes #8

See merge request !69
parents 90b3a31d d014a138
No related branches found
No related tags found
2 merge requests!146Release CMO metadata to production,!69WS Factory from Sampling Period
Pipeline #36205 passed
......@@ -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
......
......@@ -29,11 +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"))
elif sampling_period in [SamplingPeriod.SECOND, SamplingPeriod.MINUTE]:
return EdgeFactory(host=host, port=os.getenv("DATA_EARTHWORM_PORT", "2060"))
else:
return None
......
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