diff --git a/geomagio/edge/FDSNFactory.py b/geomagio/edge/FDSNFactory.py index b4109d4d97992f45ae91bf5185559741281319c0..c1112c92a197d3e45eb121ca323e54db8b95efc9 100644 --- a/geomagio/edge/FDSNFactory.py +++ b/geomagio/edge/FDSNFactory.py @@ -285,11 +285,6 @@ class FDSNFactory(TimeseriesFactory): if data.count() == 0: return data - if data.count() != 0: - TimeseriesUtility.pad_and_trim_trace( - trace=data[0], starttime=starttime, endtime=endtime - ) - self._set_metadata(data, observatory, channel, type, interval) return data @@ -302,10 +297,12 @@ class FDSNFactory(TimeseriesFactory): channels: List[str], ): """Post process a timeseries stream after the raw data is - is fetched from querymom. Specifically changes - any MaskedArray to a ndarray with nans representing gaps. - Then calls pad_timeseries to deal with gaps at the - beggining or end of the streams. + is fetched from FDSN client. Specifically: + - adds USGS provisional data disclaimer + - changes any MaskedArray to ndarray with nans as gaps + - converts arcminutes to radians for any "D" channels + - calls pad_timeseries to deal with gaps at the + beggining or end of the streams. Parameters ---------- @@ -335,6 +332,16 @@ class FDSNFactory(TimeseriesFactory): if not any("DISCLAIMER" in comment for comment in trace.stats.comments): trace.stats.comments.extend(disclaimer_texts) + if isinstance(trace.data, numpy.ma.MaskedArray): + trace.data.set_fill_value(numpy.nan) + trace.data = trace.data.filled() + + if "D" in channels: + for trace in timeseries.select(channel="D"): + trace.data = ChannelConverter.get_radians_from_minutes(trace.data) + + TimeseriesUtility.pad_timeseries(timeseries, starttime, endtime) + def _set_metadata( self, stream: Stream,