def read(self, **kwargs):
"""Read this timeseries from file using GWpy. If the file is not
present, an IOError is raised, UNLESS an unsuccessful attempt has been
made to download the file, in which case it raises an
NDS2Exception (a custom error type)."""
try:
return gwpy.timeseries.TimeSeries.read(self.fname, **kwargs)
except IOError as e:
if not self.query_failed():
msg = ('tried concatenating data, but a download attempt seems '
'not to have been made for this query: {} See IOError '
'message: {}').format(self, e)
logging.error(msg)
raise IOError(('Aborting concatenation. Neither an error log '
'file nor a saved timeseries file were found '
'for this query: {}').format(self))
else:
logging.warn(('While reading, encountered failed query: '
'{}. Padding...').format(self))
raise NDS2Exception(('This query seems to have failed '
'downloading: {}').format(self))
评论列表
文章目录