# http://pyrocko.org - GPLv3 # # The Pyrocko Developers, 21st Century # ---|P------/S----------~Lg----------
except ZeroDivisionError: have_zero_rate_traces = True continue
network, station, location, channel, tmin, tmax, deltat, ydata))
except (OSError, mseed_ext.MSeedError) as e: raise FileLoadError(str(e)+' (file: %s)' % filename)
logger.warning( 'Ignoring traces with sampling rate of zero in file %s ' '(maybe LOG traces)' % filename)
itmin, itmax, srate, tr.get_ydata())
record_length=4096):
['network', 'station', 'location', 'channel'], [2, 5, 2, 3], tr.nslc_id):
raise CodeTooLong( '%s code too long to be stored in MSeed file: %s' % (code, val))
raise FileSaveError('File exists: %s' % fn)
except mseed_ext.MSeedError as e: raise FileSaveError( str(e) + ' (while storing traces to file \'%s\')' % fn)
if len(first512) < 256: return False
rec = first512
try: sequence_number = int(rec[:6]) except Exception: return False if sequence_number < 0: return False
type_code = rec[6:7] if type_code in b'DRQM': bads = [] for sex in '<>': bad = False fmt = sex + '6s1s1s5s2s3s2s10sH2h4Bl2H' vals = unpack(fmt, rec[:48]) fmt_btime = sex + 'HHBBBBH' tvals = unpack(fmt_btime, vals[7]) if tvals[1] < 1 or tvals[1] > 367 or tvals[2] > 23 or \ tvals[3] > 59 or tvals[4] > 60 or tvals[6] > 9999: bad = True
bads.append(bad)
if all(bads): return False
else: if type_code not in b'VAST': return False
continuation_code = rec[7:8] if continuation_code != b' ': return False
blockette_type = rec[8:8+3].decode() if not re.match(r'^\d\d\d$', blockette_type): return False
try: blockette_length = int(rec[11:11+4]) except Exception: return False
if blockette_length < 7: return False
return True |