Skip to content
Snippets Groups Projects

Overhaul EdgeFactory and MiniSeedFactory for Edge data migration

Files
3
+ 19
18
@@ -75,6 +75,8 @@ class EdgeFactory(TimeseriesFactory):
sncl_mode: {'geomag','legacy'}
force mode to convert common names to SEED SNCL codes (that is,
station, network, channel, location codes); default = legacy
timeout: float
timeout for Earthworm client; default=10
See Also
--------
@@ -106,6 +108,7 @@ class EdgeFactory(TimeseriesFactory):
convert_channels: Optional[List[str]] = None,
scale_factor: Optional[int] = None,
sncl_mode: Optional[str] = "legacy",
timeout: Optional[float] = None,
):
TimeseriesFactory.__init__(self, observatory, channels, type, interval)
self.host = host or "edgecwb.usgs.gov"
@@ -118,6 +121,7 @@ class EdgeFactory(TimeseriesFactory):
self.convert_channels = convert_channels or []
self.scale_factor = scale_factor
self.sncl_mode = sncl_mode
self.timeout = timeout or 10
if sncl_mode == "legacy":
self.get_sncl = LegacySNCL.get_sncl
elif sncl_mode == "geomag":
@@ -409,7 +413,7 @@ class EdgeFactory(TimeseriesFactory):
data = Stream()
for port in ports:
try:
client = earthworm.Client(self.host, port, timeout=10)
client = earthworm.Client(self.host, port, timeout=self.timeout)
data += client.get_waveforms(
sncl.network,
@@ -651,23 +655,20 @@ class EdgeFactory(TimeseriesFactory):
# everything else (mostly magnetics stored as picoteslas)
trace_send.data = trace_send.data * (self.scale_factor or 1e3)
if self.write_port:
ric = RawInputClient(
self.tag,
self.host,
self.write_port,
sncl.station,
sncl.channel,
sncl.location,
sncl.network,
)
trace_send.data = trace_send.data.astype(int) # ric requires ints
ric.send_trace(interval, trace_send)
if self.forceout:
ric.forceout()
ric.close()
else:
raise TimeseriesFactoryException("Valid write port was not specified.")
ric = RawInputClient(
self.tag,
self.host,
self.write_port,
sncl.station,
sncl.channel,
sncl.location,
sncl.network,
)
trace_send.data = trace_send.data.astype(int) # ric requires ints
ric.send_trace(interval, trace_send)
if self.forceout:
ric.forceout()
ric.close()
def _set_metadata(
self,
Loading