From 3f4f2539babc2bc11c970284e7dba6a7a75bbd51 Mon Sep 17 00:00:00 2001 From: "E. Joshua Rigler" <erigler@usgs.gov> Date: Mon, 9 Jan 2017 15:30:44 -0700 Subject: [PATCH] Pad to urlInterval in put_timeseries() TimeseriesFactory.get_timeseries() pads to the requested interval with NaNs, filling in start/end gaps. TimeseriesFactory.put_timeseries() is supposed to do this (according to Jeremy Fee), but it was trimming NaNs from the start/ end before writing to file. This PR fixes this by using ObsPy's Stream.trim() method, in a similar manner to TimesereisFactory.get_timeseries(), to pad to the specified start and end of the urlInterval.. --- geomagio/TimeseriesFactory.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/geomagio/TimeseriesFactory.py b/geomagio/TimeseriesFactory.py index abef4d15..f0c51b31 100644 --- a/geomagio/TimeseriesFactory.py +++ b/geomagio/TimeseriesFactory.py @@ -226,6 +226,13 @@ class TimeseriesFactory(object): trace.stats.location = new_trace.stats.location url_data = TimeseriesUtility.merge_streams( existing_data, url_data) + # pad with NaN's out to urlInterval (like get_timeseries()) + url_data.trim( + starttime=urlInterval['start'], + endtime=(urlInterval['end'] - delta), + nearest_sample=False, + pad=True, + fill_value=numpy.nan) except IOError: # no data yet pass -- GitLab