# http://pyrocko.org - GPLv3 # # The Pyrocko Developers, 21st Century # ---|P------/S----------~Lg----------
def unpack(cls, s):
'SudsStructtag', 'sync, machine, struct_type, struct_length, data_length')):
'SudsStatident', 'network, st_name, component, inst_type')):
str(self.network.rstrip(b'\0 ').decode('ascii')), str(self.st_name.rstrip(b'\0 ').decode('ascii')), '', str(self.component.rstrip(b'\0 ').decode('ascii')))
'SudsStationcomp', 'sc_name, azim, incid, st_lat, st_long, elev, enclosure, annotation, ' 'recorder, rockclass, rocktype, sitecondition, sensor_type, ' 'data_type, data_units, polarity, st_status, max_gain, clip_value, ' 'con_mvolts, channel, atod_gain, effective, clock_correct, ' 'station_delay')):
def unpack(cls, s):
network=net, station=sta, location=loc, lat=self.st_lat, lon=self.st_long, elevation=self.elev)
model.Channel( name=cha, azimuth=self.azim, dip=self.incid - 90.))
'SudsDescriptrace', 'dt_name, begintime, localtime, datatype, descriptor, digi_by, ' 'processed, length, rate, mindata, maxdata, avenoise, numclip, ' 'time_correct, rate_correct')):
def unpack(cls, s):
tmax = tmin + (self.length - 1) * deltat arr = None else: elif self.datatype == b'f': arr = num.fromstring(data, dtype=num.float32) elif self.datatype == b'd': arr = num.fromstring(data, dtype=num.float64) else: raise SudsError( 'data type "%s" not implemented yet' % self.datatype)
raise SudsError('found and reported number of samples differ')
self.dt_name.network.rstrip(b'\0 '), self.dt_name.st_name.rstrip(b'\0 '), '', self.dt_name.component.rstrip(b'\0 '), ydata=arr, deltat=deltat, tmin=tmin, tmax=tmax)
0: 'no_struct', 1: 'statident', 2: 'structtag', 3: 'terminator', 4: 'equipment', 5: 'stationcomp', 6: 'muxdata', 7: 'descriptrace', 8: 'loctrace', 9: 'calibration', 10: 'feature', 11: 'residual', 12: 'event', 13: 'ev_descript', 14: 'origin', 15: 'error', 16: 'focalmech', 17: 'moment', 18: 'velmodel', 19: 'layers', 20: 'comment', 21: 'profile', 22: 'shotgather', 23: 'calib', 24: 'complex', 25: 'triggers', 26: 'trigsetting', 27: 'eventsetting', 28: 'detector', 29: 'atodinfo', 30: 'timecorrection', 31: 'instrument', 32: 'chanset'}
raise SudsError('premature end of file')
raise SudsError( 'expected and reported struct lengths differ')
raise SudsError('premature end of file')
else: f.seek(tag.data_length, 1) tr = s.to_trace(None)
else:
else: logger.warning( 'skipping unsupported SUDS struct type %s (%s)' % ( tag.struct_type, struct_names.get(tag.struct_type, '?')))
f.seek(tag.struct_length, 1)
if tag.data_length > 0: f.seek(tag.data_length, 1)
except (OSError, SudsError) as e: raise FileLoadError(e)
finally:
('.'.join(s.nsl()) + '.' + s.get_channels()[0].name, s.lat, s.lon, s.elevation) for s in group]
return False
or tag.machine != b'6' \ or tag.struct_type < 0 \ or tag.struct_type > max_struct_type:
return False
if __name__ == '__main__': util.setup_logging('pyrocko.suds')
trs = list(iload(sys.argv[1], 'rb'))
stations = load_stations(sys.argv[1])
for station in stations: print(station)
trace.snuffle(trs, stations=stations) |