Skip to content
Snippets Groups Projects
Commit 5cbce9b7 authored by Erin (Josh) Rigler's avatar Erin (Josh) Rigler
Browse files

More compatibility changes (EdgeFactory vs. MiniSeedFactory)

parent 2d7c3cdd
No related branches found
No related tags found
1 merge request!386Overhaul EdgeFactory and MiniSeedFactory for Edge data migration
...@@ -75,6 +75,8 @@ class EdgeFactory(TimeseriesFactory): ...@@ -75,6 +75,8 @@ class EdgeFactory(TimeseriesFactory):
sncl_mode: {'geomag','legacy'} sncl_mode: {'geomag','legacy'}
force mode to convert common names to SEED SNCL codes (that is, force mode to convert common names to SEED SNCL codes (that is,
station, network, channel, location codes); default = legacy station, network, channel, location codes); default = legacy
timeout: float
timeout for Earthworm client; default=10
See Also See Also
-------- --------
...@@ -106,6 +108,7 @@ class EdgeFactory(TimeseriesFactory): ...@@ -106,6 +108,7 @@ class EdgeFactory(TimeseriesFactory):
convert_channels: Optional[List[str]] = None, convert_channels: Optional[List[str]] = None,
scale_factor: Optional[int] = None, scale_factor: Optional[int] = None,
sncl_mode: Optional[str] = "legacy", sncl_mode: Optional[str] = "legacy",
timeout: Optional[float] = None,
): ):
TimeseriesFactory.__init__(self, observatory, channels, type, interval) TimeseriesFactory.__init__(self, observatory, channels, type, interval)
self.host = host or "edgecwb.usgs.gov" self.host = host or "edgecwb.usgs.gov"
...@@ -118,6 +121,7 @@ class EdgeFactory(TimeseriesFactory): ...@@ -118,6 +121,7 @@ class EdgeFactory(TimeseriesFactory):
self.convert_channels = convert_channels or [] self.convert_channels = convert_channels or []
self.scale_factor = scale_factor self.scale_factor = scale_factor
self.sncl_mode = sncl_mode self.sncl_mode = sncl_mode
self.timeout = timeout or 10
if sncl_mode == "legacy": if sncl_mode == "legacy":
self.get_sncl = LegacySNCL.get_sncl self.get_sncl = LegacySNCL.get_sncl
elif sncl_mode == "geomag": elif sncl_mode == "geomag":
...@@ -409,7 +413,7 @@ class EdgeFactory(TimeseriesFactory): ...@@ -409,7 +413,7 @@ class EdgeFactory(TimeseriesFactory):
data = Stream() data = Stream()
for port in ports: for port in ports:
try: try:
client = earthworm.Client(self.host, port, timeout=10) client = earthworm.Client(self.host, port, timeout=self.timeout)
data += client.get_waveforms( data += client.get_waveforms(
sncl.network, sncl.network,
...@@ -651,23 +655,20 @@ class EdgeFactory(TimeseriesFactory): ...@@ -651,23 +655,20 @@ class EdgeFactory(TimeseriesFactory):
# everything else (mostly magnetics stored as picoteslas) # everything else (mostly magnetics stored as picoteslas)
trace_send.data = trace_send.data * (self.scale_factor or 1e3) trace_send.data = trace_send.data * (self.scale_factor or 1e3)
if self.write_port: ric = RawInputClient(
ric = RawInputClient( self.tag,
self.tag, self.host,
self.host, self.write_port,
self.write_port, sncl.station,
sncl.station, sncl.channel,
sncl.channel, sncl.location,
sncl.location, sncl.network,
sncl.network, )
) trace_send.data = trace_send.data.astype(int) # ric requires ints
trace_send.data = trace_send.data.astype(int) # ric requires ints ric.send_trace(interval, trace_send)
ric.send_trace(interval, trace_send) if self.forceout:
if self.forceout: ric.forceout()
ric.forceout() ric.close()
ric.close()
else:
raise TimeseriesFactoryException("Valid write port was not specified.")
def _set_metadata( def _set_metadata(
self, self,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment