obspy/obspy — pull request #515 by krischer (2013-02-18 15:01:30+00:00)
Title: Cannot read miniseed files with far future dates

I am unable to read miniSEED files with a date of 2070/11/29. This could be a simple problem if ObsPy uses an older version of libmseed, which could not read or write dates after 2037 (because of a 32-bit seconds field). Updating to the latest libmseed would fix this.

Alternatively, some miniSEED reading scripts use the date to guess the endian-ness: these fail for any date after 2055.

I can provide an example miniSEED file if you want

The error message is:
```python
>In [23]: st=read('2070-11-27-1159-07M.LSb12_004')
>
>---------------------------------------------------------------------------
>TypeError Traceback (most recent call last)
> in ()
>----> 1 st=read('2070-11-27-1159-07M.LSb12_004')
>
>/Applications/ObsPy.app/Contents/MacOS/lib/python2.7/site-packages/obspy/core/stream.pyc in read(pathname_or_url, format, headonly, starttime, endtime, nearest_sample, dtype, apply_calib, **kwargs)
> 245 pathname = pathname_or_url
> 246 for file in sorted(glob(pathname)):
>--> 247 st.extend(_read(file, format, headonly, **kwargs).traces)
> 248 if len(st) == 0:
> 249 # try to give more specific information why the stream is empty
>
>/Applications/ObsPy.app/Contents/MacOS/lib/python2.7/site-packages/obspy/core/util/decorator.pyc in wrapped_func(filename, *args, **kwargs)
> 149 else:
> 150 # call wrapped function with original filename
>--> 151 result = func(filename, *args, **kwargs)
> 152 return result
> 153 return wrapped_func
>
>/Applications/ObsPy.app/Contents/MacOS/lib/python2.7/site-packages/obspy/core/stream.pyc in _read(filename, format, headonly, **kwargs)
> 286 """
> 287 stream, format = _readFromPlugin('waveform', filename, format=format,
>--> 288 headonly=headonly, **kwargs)
> 289 # set _format identifier for each element
> 290 for trace in stream:
>
>/Applications/ObsPy.app/Contents/MacOS/lib/python2.7/site-packages/obspy/core/util/base.pyc in _readFromPlugin(plugin_type, filename, format, **kwargs)
> 411 raise TypeError(msg % (format_ep.name, ', '.join(EPS)))
> 412 # read
>--> 413 list_obj = readFormat(filename, **kwargs)
> 414 return list_obj, format_ep.name
> 415

>/Applications/ObsPy.app/Contents/MacOS/lib/python2.7/site-packages/obspy/mseed/core.pyc in readMSEED(mseed_object, starttime, endtime, headonly, sourcename, reclen, recinfo, details, **kwargs)
> 176 # Parse some information about the file.
> 177 if recinfo:
>--> 178 info = util.getRecordInformation(mseed_object)
> 179 info['encoding'] = ENCODINGS[info['encoding']][0]
> 180 # Only keep information relevant for the whole file.
>
>/Applications/ObsPy.app/Contents/MacOS/lib/python2.7/site-packages/obspy/mseed/util.pyc in getRecordInformation(file_or_file_object, offset)
> 243 if isinstance(file_or_file_object, basestring):
> 244 with open(file_or_file_object, 'rb') as f:
>--> 245 info = _getRecordInformation(f, offset=offset)
> 246 else:
> 247 info = _getRecordInformation(file_or_file_object, offset=offset)
>
>/Applications/ObsPy.app/Contents/MacOS/lib/python2.7/site-packages/obspy/mseed/util.pyc in _getRecordInformation(file_object, offset)
> 323 starttime = UTCDateTime(year=values[0], julday=values[1], hour=values[2],
> 324 minute=values[3], second=values[4],
>--> 325 microsecond=values[5] * 100)
> 326 npts = values[6]
> 327 info['npts'] = npts
>
>/Applications/ObsPy.app/Contents/MacOS/lib/python2.7/site-packages/obspy/core/utcdatetime.pyc in __init__(self, *args, **kwargs)
> 321 kwargs['second'] = int(args[5])
> 322 args = args[0:5]
>--> 323 dt = datetime.datetime(*args, **kwargs)
> 324 self._fromDateTime(dt)
> 325
```