本文整理汇总了Python中obspy.core.Trace.stats['channel']方法的典型用法代码示例。如果您正苦于以下问题:Python Trace.stats['channel']方法的具体用法?Python Trace.stats['channel']怎么用?Python Trace.stats['channel']使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类obspy.core.Trace
的用法示例。
在下文中一共展示了Trace.stats['channel']方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: aquireGreens
# 需要导入模块: from obspy.core import Trace [as 别名]
# 或者: from obspy.core.Trace import stats['channel'] [as 别名]
#.........这里部分代码省略.........
freq = i*df
if(freq < df):
freq = 0.01*df
om = twpi * freq
for i in range(n2+0,nyq):
data[i] = complex(0.0,0.0)
# conjug
for i in range(1,n2+0):
data[n+0-i] = data[i].conjugate()
data[0] = complex(0.0,0.0)
data[nyq-1] = complex(0.0,0.0)
# From spectraToTime
data = four1(data,n,1,dt,df)
# Apply damping factor
fac = exp(alpha*t0x)
dfac = exp(alpha*dt)
for i in range(len(data)):
data[i]=(data[i])*fac
fac = fac * dfac
# velocity to displavement if required
if(ivel=='1'):
data=velTodisData(data,dt)
# put data into trace
prel = 0
prel = int(eval(args.pre) / eval(args.delta))
length=numpy.arange(len(data)+prel)*0.0
t=Trace(length)
for i in range(len(data)):
t.data[i+prel]=data[i]
t.stats['delta'] = dt
t.stats['dist'] = Range[j]
name = 'GREEN_' + str(t.stats['dist'])
t.stats['station'] = name
# update stats and apply -1 for tss,xds,zss,zdd
if k==7:
t.stats['channel'] = 'tss'
for i in range(len(data)):
t.data[i] = t.data[i]*(-1)
if k==4:
t.stats['channel'] = 'tds'
for i in range(len(data)):
t.data[i] = t.data[i]*(+1)
if k==6:
t.stats['channel'] = 'xss'
for i in range(len(data)):
t.data[i] = t.data[i]*(+1)
if k==3:
t.stats['channel'] = 'xds'
for i in range(len(data)):
t.data[i] = t.data[i]*(-1)
if k==1:
t.stats['channel'] = 'xdd'
for i in range(len(data)):
t.data[i] = t.data[i]*(+1)
if k==5:
t.stats['channel'] = 'zss'
for i in range(len(data)):
t.data[i] = t.data[i]*(-1)
if k==2:
t.stats['channel'] = 'zds'
for i in range(len(data)):
t.data[i] = t.data[i]*(+1)
if k==0:
t.stats['channel'] = 'zdd'
for i in range(len(data)):
t.data[i] = t.data[i]*(-1)
if k==8:
t.stats['channel'] = 'ex1'
# t.data[i] = t.data[i]
# if(args.iso=='1'):
# for i in range(len(data)):
# t.data[i] = 0.0
# else:
# for i in range(len(data)):
# t.data[i] = 0.0
if k==9:
t.stats['channel'] = 'ex2'
# t.data[i] = t.data[i]
# if(args.iso=='1'):
# for i in range(len(data)):
# t.data[i] = 0.0
# else:
# for i in range(len(data)):
# t.data[i] = 0.0
green.append(t)
return green
示例2: usarray_read
# 需要导入模块: from obspy.core import Trace [as 别名]
# 或者: from obspy.core.Trace import stats['channel'] [as 别名]
def usarray_read(fname):
""" Read the BAM US-Array lbv data format used on Mike-2 test specimen.
Read the BAM US-Array lbv data format used on Mike-2 test specimen into a
stream object.
As there is no obvious station (or any other) information in the data file.
As the parameters are not supposed to change, they are hardcoded here.
:parameters:
------------
:type fname: string
:param fname: Path to the file containing the data to be read
(WITHOUT EXTENSION) extensions .dat and .hdr will be added
automatically
:rtype: :class:`~obspy.core.Stream` object
:return: **st**: obspy.core.Stream object
Obspy stream object containing the data
"""
# filenames
lbvfilename = fname + '.lbv'
hdrfilename = fname + '.hdr'
# initialise
st = Stream()
tr = Trace()
# tr = SacIO()
# static parameters
t = os.path.getmtime(hdrfilename)
tt = datetime.datetime.fromtimestamp(t)
tr.stats['starttime'] = UTCDateTime(tt.year, tt.month, tt.day, tt.hour,
tt.minute, tt.second, tt.microsecond)
tr.stats['network'] = 'BAM-USArray'
tr.stats['channel'] = 'z'
# reading header from file
fh = open(hdrfilename, 'r')
while True:
line = fh.readline()
if line.__len__() < 1:
break
line = line.rstrip()
if line.find('PK') > -1:
parts = re.split(':', line)
tr.stats['location'] = parts[1].lstrip()
if line.find('transceivers') > -1:
parts = re.split(':', line)
ntra = int(parts[1].lstrip())
traco = np.zeros((ntra, 3), float)
for i in range(ntra):
coordstr = fh.readline().split()
for j in range(3):
traco[i, j] = float(coordstr[j])
if line.find('measurements') > -1:
parts = re.split(':', line)
nmeas = int(parts[1].lstrip())
measco = np.zeros((nmeas, 2), int)
for i in range(nmeas):
configstr = fh.readline().split()
for j in range(2):
measco[i, j] = float(configstr[j])
if line.find('samples') > -1:
parts = re.split(':', line)
tr.stats['npts'] = int(parts[1].lstrip())
if line.find('samplefreq') > -1:
parts = re.split(':', line)
tr.stats['sampling_rate'] = int(parts[1].lstrip())
fh.close()
# reading data from file
fd = open(lbvfilename, 'rb')
datatype = '>i2'
read_data = np.fromfile(file=fd, dtype=datatype)
fd.close()
# sort and store traces
for i in range(nmeas):
# receiver number stored as station name
tr.stats['station'] = str(measco[i, 1])
# receiver coords (storing not yet implemented)
stla = traco[measco[i, 1] - 1, 1] # x
stlo = traco[measco[i, 1] - 1, 1] # y
stel = traco[measco[i, 1] - 1, 1] # z
# transmitter number stored as event name (storing not yet implemented)
kevnm = str(measco[i, 0])
# transmitter coords (storing not yet implemented)
evla = traco[measco[i, 1] - 1, 0] # x
evlo = traco[measco[i, 1] - 1, 0] # y
evdp = traco[measco[i, 1] - 1, 0] # z
tr.data = read_data[i * tr.stats.npts:(i + 1) * tr.stats.npts]
st.extend([tr])
# plot 1 trace for test purposes
# if i==20:
# tr.plot()
# print ('plot done')
return st