{"action":"opened","issue":{"url":"https://api.github.com/repos/usgs/geomag-algorithms/issues/184","repository_url":"https://api.github.com/repos/usgs/geomag-algorithms","labels_url":"https://api.github.com/repos/usgs/geomag-algorithms/issues/184/labels{/name}","comments_url":"https://api.github.com/repos/usgs/geomag-algorithms/issues/184/comments","events_url":"https://api.github.com/repos/usgs/geomag-algorithms/issues/184/events","html_url":"https://github.com/usgs/geomag-algorithms/issues/184","id":264363329,"number":184,"title":"ObsPy trim does not pad internal gaps with fill value","user":{"login":"erigler-usgs","id":11222895,"avatar_url":"https://avatars2.githubusercontent.com/u/11222895?v=4","gravatar_id":"","url":"https://api.github.com/users/erigler-usgs","html_url":"https://github.com/erigler-usgs","followers_url":"https://api.github.com/users/erigler-usgs/followers","following_url":"https://api.github.com/users/erigler-usgs/following{/other_user}","gists_url":"https://api.github.com/users/erigler-usgs/gists{/gist_id}","starred_url":"https://api.github.com/users/erigler-usgs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/erigler-usgs/subscriptions","organizations_url":"https://api.github.com/users/erigler-usgs/orgs","repos_url":"https://api.github.com/users/erigler-usgs/repos","events_url":"https://api.github.com/users/erigler-usgs/events{/privacy}","received_events_url":"https://api.github.com/users/erigler-usgs/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-10-10T20:22:09Z","updated_at":"2017-10-10T20:22:09Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"https://github.com/usgs/geomag-algorithms/blob/3d317e96361ef4a9adade8326ee44aa09359237a/geomagio/TimeseriesFactory.py#L130\r\n\r\nBy default, ObsPy's `Stream.merge()` does not pad gaps with fill values, but rather creates a masked array.\r\n\r\nHowever, the action `Trace.trim(..., pad=True, fill_value=numpy.NaN)`  does not pad internal gaps as far as I can tell from looking at the source code. It only pads the ends of a trace. \r\n\r\nAs a result, when it is called like the example linked above, and there is a gap in the middle of the trace (possible when whole files are missing in the expected URL sequence generated by `TimeseriesFactory.get_timeseries()`), a gap filled with the default masked array values (i.e., 1e+20) gets left behind.\r\n\r\nThis all became apparent when I plotted a trace that had been generated from an incomplete sequence of IAGA2002 daily files. Whole-day intervals with values of 1e+20 were plotted where I expected gaps.\r\n\r\nI **think** the solution is to use the `fill_value` option to `Stream.merge()`, which is called just prior to the trim() action noted above, but I'm not sure how this might impact other Geomag-Algorithms logic."}}
{"actor":{"display_login":"erigler-usgs"}}