Minor changes
This commit is contained in:
parent
8a84342883
commit
8592557613
@ -12,54 +12,70 @@ __version__ = _getVersionString()
|
|||||||
|
|
||||||
def picksExport(picks, locrt, phasefile):
|
def picksExport(picks, locrt, phasefile):
|
||||||
'''
|
'''
|
||||||
Take <picks> dictionary and exports picking data to a NLLOC-obs <phasefile> without creating an ObsPy event object.
|
Take <picks> dictionary and exports picking data to a NLLOC-obs
|
||||||
|
<phasefile> without creating an ObsPy event object.
|
||||||
|
|
||||||
:param picks: picking data dictionary
|
:param picks: picking data dictionary
|
||||||
:type picks: dict
|
:type picks: dict
|
||||||
|
|
||||||
:param locrt: choose location routine
|
:param locrt: choose location routine
|
||||||
:type locrt: str
|
:type locrt: str
|
||||||
|
|
||||||
:param phasefile: complete path to the exporting obs file
|
:param phasefile: complete path to the exporting obs file
|
||||||
:type phasefile: str
|
:type phasefile: str
|
||||||
'''
|
'''
|
||||||
# write phases to NLLoc-phase file
|
# write phases to NLLoc-phase file
|
||||||
writephases(picks, locrt, phasefile)
|
writephases(picks, locrt, phasefile)
|
||||||
|
|
||||||
def modfiyInputFile(fn, root, outpath, phasefn, tttn):
|
def modifyInputFile(ctrfn, root, nllocoutn, phasefn, tttn):
|
||||||
'''
|
'''
|
||||||
|
:param ctrfn: name of NLLoc-control file
|
||||||
|
:type: str
|
||||||
|
|
||||||
:param fn:
|
:param root: root path to NLLoc working directory
|
||||||
:param root:
|
:type: str
|
||||||
:param outpath:
|
|
||||||
:param phasefile:
|
:param nllocoutn: name of NLLoc-location output file
|
||||||
:param tttable:
|
:type: str
|
||||||
:return:
|
|
||||||
|
:param phasefn: name of NLLoc-input phase file
|
||||||
|
:type: str
|
||||||
|
|
||||||
|
:param tttn: pattern of precalculated NLLoc traveltime tables
|
||||||
|
:type: str
|
||||||
'''
|
'''
|
||||||
# For locating the event we have to modify the NLLoc-control file!
|
# For locating the event the NLLoc-control file has to be modified!
|
||||||
# create comment line for NLLoc-control file NLLoc-output file
|
# create comment line for NLLoc-control file NLLoc-output file
|
||||||
print ("Modifying NLLoc-control file %s ..." % fn)
|
ctrfile = os.path.join(root, 'run', ctrfn)
|
||||||
nllocout = os.path.join(root,'loc', outpath)
|
nllocout = os.path.join(root,'loc', nllocoutn)
|
||||||
phasefile = os.path.join(root, 'obs', phasefn)
|
phasefile = os.path.join(root, 'obs', phasefn)
|
||||||
tttable = os.path.join(root, 'time', tttn)
|
tttable = os.path.join(root, 'time', tttn)
|
||||||
locfiles = 'LOCFILES %s NLLOC_OBS %s %s 0\n' % (phasefile, tttable, nllocout)
|
locfiles = 'LOCFILES %s NLLOC_OBS %s %s 0\n' % (phasefile, tttable, nllocout)
|
||||||
|
|
||||||
# modification of NLLoc-control file
|
# modification of NLLoc-control file
|
||||||
curlocfiles = getPatternLine(fn, 'LOCFILES')
|
print ("Modifying NLLoc-control file %s ..." % ctrfile)
|
||||||
nllfile = open(fn, 'r')
|
curlocfiles = getPatternLine(ctrfile, 'LOCFILES')
|
||||||
|
nllfile = open(ctrfile, 'r')
|
||||||
filedata = nllfile.read()
|
filedata = nllfile.read()
|
||||||
if filedata.find(locfiles) < 0:
|
if filedata.find(locfiles) < 0:
|
||||||
# replace old command
|
# replace old command
|
||||||
filedata = filedata.replace(curlocfiles, locfiles)
|
filedata = filedata.replace(curlocfiles, locfiles)
|
||||||
nllfile = open(fn, 'w')
|
nllfile = open(ctrfile, 'w')
|
||||||
nllfile.write(filedata)
|
nllfile.write(filedata)
|
||||||
nllfile.close()
|
nllfile.close()
|
||||||
|
|
||||||
def locate(call, fnin):
|
def locate(call, fnin):
|
||||||
'''
|
'''
|
||||||
Takes paths to NLLoc executable <call> and input parameter file <fnin> and starts the location calculation.
|
Takes paths to NLLoc executable <call> and input parameter file <fnin>
|
||||||
|
and starts the location calculation.
|
||||||
|
|
||||||
:param call: full path to NLLoc executable
|
:param call: full path to NLLoc executable
|
||||||
:type call: str
|
:type call: str
|
||||||
|
|
||||||
:param fnin: full path to input parameter file
|
:param fnin: full path to input parameter file
|
||||||
:type fnin: str
|
:type fnin: str
|
||||||
'''
|
'''
|
||||||
|
|
||||||
# locate the event
|
# locate the event
|
||||||
subprocess.call([call, fnin])
|
subprocess.call([call, fnin])
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user