예제 #1
0
 def add_stations(self, inSta):
     """Add station list
     """
     try:
         self.stalst = self.stalst + inSta
     except TypeError:
         SLst = stations.StaLst()
         SLst.read(inSta)
         self.stalst = self.stalst + SLst
     return
예제 #2
0
 def Readsac(self, datadir, stalst=None, distfile=None, comptype=['ZVF'], verbose=False, evlo=0., evla=0., evdp=0.):
     """ Read SAC files into ASDF dataset according to given station list
     ===========================================================================================================
     Input Parameters:
     distfile    - distance file name
     stalst      - station list or station file name
     datadir     - data directory
     comptype    - component type (default=ZVF)
     Output:
     self.waveforms
     ===========================================================================================================
     """
     if stalst == None and distfile == None:
         raise ValueError('At least one of stafile/distfile need to be specified!')
     print 'Start reading sac files!'
     if stalst == None:
         SLst    = stations.StaLst()
         SLst.read_distfile(distfname=distfile)
     else:
         if isinstance(stalst, stations.StaLst):
             SLst    = stalst
         else:
             SLst    = stations.StaLst()
             SLst.read(stafile=stafile)
     StaInv  = SLst.GetInventory() 
     self.add_stationxml(StaInv)
     chandict= {'ZDD': '01', 'RDD': '02', 'ZDS': '03', 'RDS': '04', 'TDS': '05', 'ZSS': '06', 'RSS': '07', 'TSS': '08',
                 'ZEX': '09', 'REX': '10', 'ZVF': '11', 'RVF': '12', 'ZHF': '13', 'RHF': '14', 'THF': '15'}
     for sta in SLst.stations:
         if verbose:
             print 'Reading sac file:', sta.network,sta.stacode
         station_id_aux  = sta.network+sta.stacode
         for comp in comptype:
             sacfname        = datadir+'/'+sta.stacode+chandict[comp]+comp+'.sac'
             tr              = obspy.read(sacfname)[0]
             tr.stats.network= sta.network
             tr.stats.station= sta.stacode
             self.add_waveforms(tr, tag='cps_raw')
             self.add_auxiliary_data(data=np.array([sta.distance]), data_type='DIST', path=station_id_aux, parameters={})
     self.AddEvent(lon=evlo, lat=evla, z=evdp)
     print 'End reading sac files!'
     return
예제 #3
0
import stations

SLst = stations.StaLst()
SLst.ReadDistFile('dfile')
SLst.WriteStaList('stations.lst')

SLst2 = stations.StaLst()
# SLst.ReadDistFile('dfile')
SLst2.ReadStaList('stations.lst')
inv = SLst.GetInventory()
예제 #4
0
#!/usr/bin/env python
import symdata
import stations
import numpy as np
import obspy
import obspy.signal.filter
import matplotlib.pyplot as plt
from scipy.fftpack import hilbert

degree_sign = u'\N{DEGREE SIGN}'
datadir = '/lustre/janus_scratch/life9360/ses3d_working_dir_2016/OUTPUT'
stafile = '/lustre/janus_scratch/life9360/ses3d_working_dir_2016/INPUT/recfile_1'
dbase = symdata.ses3dASDF(
    '/lustre/janus_scratch/life9360/ASDF_data/ses3d_2016_10sec_3comp.h5')

SLst = stations.StaLst()
SLst.read(stafile)
evlo = 129.0
evla = 41.306
st = dbase.get_stream(staid='SES.98S47', SLst=SLst)
st.decimate(10)
stla, elve, stlo = dbase.waveforms['SES.98S47'].coordinates.values()
dt = st[0].stats.delta
dist, az, baz_ev = obspy.geodetics.gps2dist_azimuth(stla, stlo, evla, evlo)
dist = dist / 1000.
bazArr = baz_ev + np.arange(50) - 25.  ###
#
# tmin=640; tmax=710; twin=2; tlength=20;
vmin = 2.
vmax = 5.
tmin = dist / vmax
예제 #5
0
def main():
    outdir = '/lustre/janus_scratch/life9360/ses3d_working_dir_2016/INPUT'
    # outdir='/lustre/janus_scratch/life9360/ses3d_working_2016_US/INPUT'
    #########################
    # Qmodel
    # Q_model=Qmodel.Qmodel( fmin=1.0/20., fmax=1/10.)
    # Q_model.Qdiscrete()
    # # #
    # # # # D=np.array([1.684, 0.838, 1.357])
    # # # # tau_s=np.array([3.2, 17.692, 74.504])
    # # # # Q_model.plotQdiscrete( D=D, tau_s=tau_s )
    # Q_model.plotQdiscrete()
    # Q_model.write(outdir=outdir)
    # return
    #########################
    # #################
    # stations
    SLst = stations.StaLst()
    SLst.homo_stalst(minlat=22.5,
                     Nlat=116,
                     minlon=85.5,
                     Nlon=188,
                     dlat=0.25,
                     dlon=0.25,
                     net='EA')
    # # SLst.homo_stalst(minlat = 24.5, Nlat = 100, minlon=-119.5, Nlon = 156, dlat=0.25, dlon=0.25, net='US')
    # SLst.write(outdir=outdir)
    # return
    #################
    # events
    evlo = 129.0
    evla = 41.306
    # evlo=-100.0
    # evla=40.
    Mw = 4.0
    evdp = 1.0

    dt = 0.05
    num_timpstep = 30000
    fmin = 1. / 20.
    fmax = 1. / 10.
    STF = events.STF()
    # STF.RickerIntSignal(dt=dt, npts=num_timpstep, fc=0.1)

    STF.StepSignal(dt=dt, npts=num_timpstep)
    STF.filter('bandpass', freqmin=fmin, freqmax=fmax)
    # STF.filter('highpass', freq=fmin, corners=4, zerophase=False)
    # STF.filter('lowpass', freq=fmax, corners=4, zerophase=False)
    # STF.plotfreq()
    # stime=STF.stats.starttime
    # STF.plot(starttime=stime, endtime=stime+200., type='relative')
    ##################
    #SES3D configuration

    minlat = 22.
    maxlat = 52.
    minlon = 85.
    maxlon = 133.
    # minlat=24.
    # maxlat=50.
    # minlon=-120.0
    # maxlon=-80.

    zmin = 0.
    zmax = 200.

    # nx_global=420
    # ny_global=600
    # nz_global=27
    nx_global = 420
    ny_global = 624
    nz_global = 27

    px = 10
    py = 12
    pz = 3

    inGen = input_generator.InputFileGenerator()
    inGen.set_config(num_timpstep=num_timpstep, dt=dt, nx_global=nx_global, ny_global=ny_global, nz_global=nz_global,\
        px=px, py=py, pz=pz, minlat=minlat, maxlat=maxlat, minlon=minlon, maxlon=maxlon, zmin=zmin, zmax=zmax)
    inGen.add_explosion(longitude=evlo, latitude=evla, depth=1., m0=1.45e15)
    # STF=events.STF()
    # STF.GaussianSignal(dt=dt, npts=num_timpstep, fc= 0.1)
    # inGen.get_stf(stf=STF, fmin=0.01, fmax=0.1, vmin=1.)
    inGen.get_stf(stf=STF, vmin=2.0, fmax=1. / 8.)
    inGen.add_stations(SLst)
    inGen.write(outdir=outdir)
    return inGen
예제 #6
0
 def __init__(self):
     self.config = AttribDict()
     self.events = events.ses3dCatalog()
     self.stalst = stations.StaLst()
     # self.vmodel
     return