Here are the examples of the python api sys.srgv taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
1 Examples
0
Example 1
Project: mtpy Source File: runparalanamt.py
def main():
arglist = sys.srgv[1:]
if len(arglist) < 5:
sys.exit('ERROR -- provide 5 arguments: <station folders directory> <processing parameter file> <station info file> <BIRRP executable> <EDI files directory>')
#===============================================================================
# Input files
#===============================================================================
#directory where station folders are
dirpath = op.abspath(arglist[0])
#dirpath=r'g:\ParalanaSept2011'
#dirpath=r'G:\University dos\Monash\Processing'
#dirpath=r"c:\Sept2011"
#file where all the processing parameters are, ie day, start time, end time
#and birrp parameters like tbw, thetae, etc
#processinginfofile=r'F:\InjectionJuly2011\Day199.txt'
#processinginfofile=r'c:\Sept2011\Sept2011pf.txt'
#processinginfofile=r'g:\University dos\Monash\Processing\sashapro.txt'
#processinginfofile=r"/wolle/InjectionJuly2011/AdvPro24Hrs100Hz.txt"
#processinginfofile=r"/wolle/InjectionJuly2011/InjectionHours.csv"
processinginfofile = op.abspath(arglist[1])
#file where the station info is, ie lat, long, ex, ey, notes
#stationinfofile=r'c:\Sept2011\Sept2011Info.txt'
#stationinfofile=r'c:\InjectionJuly2011\InjectionJuly2011Info.txt'
stationinfofile = op.abspath(arglist[2])
#stationinfofile=r'g:\University dos\Monash\Processing\SashaInfo.txt'
#the location of birrp5.exe on your computer, can be the full path to the
#executable like r"c:\BIRRP\birrp5Optimized.exe"
#birrploc=r"c:\Peacock\PHD\BIRRP\birrp5_3pcs20E9ptsOptimized.exe"
birrploc = op.abspath(arglist[3])
#birrploc=r"c:\Peacock\PHD\BIRRP\birrp51lp.exe"
#edipath=r"c:\Sept2011\EDIfiles"
edipath = op.abspath(arglist[4])
pstart=0
#===============================================================================
# #get information from the processing file and put into a list of dictionaries
#===============================================================================
plst=brp.readProDict(processinginfofile,dirpath)
#==============================================================================
# Run in parallel
#==============================================================================
#
#jobserver=pp.Server()
#
#if len(plst[pstart:])<jobserver.get_ncpus():
# jobserver.set_ncpus(len(plst[pstart:]))
#
##jobserver.set_ncpus(1)
#print "Running ",jobserver.get_ncpus()," processors for runBIRRPpp"
#
#jobs=[]
#for prodict in plst[pstart:]:
# jobs.append(jobserver.submit(brp.runBIRRPpp,
# args=(dirpath,prodict,
# stationinfofile,
# birrploc,1),
# depfuncs=(brp.writeedi,
# brp.read2c2,
# brp.bbcalfunc,
# brp.readrf,
# brp.bbconvz,
# brp.sigfigs,
# brp.scriptfilePrep,
# brp.writeScriptfile,
# brp.callBIRRP,
# brp.convertBIRRPoutputs,
# brp.writeLogfile,
# brp.writecoh,
# brp.writedat,
# brp.writeimp,
# brp.lpconvz,),
# modules=("MTtools as mt",
# "numpy as np",
# "os",
# "subprocess",
# "time",
# "datetime",
# "BIRRPTools as brp",
# "from scipy import interpolate",
# "fnmatch",
# "shutil",
# "MTPlotTools as mtplot",)))
#
##take outputs for each station and put them into a dictionary for next step
#filelst=[]
#for job in jobs:
# filelst.append(job())
#jobserver.print_stats()
#
#jobserver.destroy()
#
#pfid=open(os.path.join(dirpath,'ppBFFiles.pkl'),'w')
#pickle.dump(filelst,pfid)
#pfid.close()
#===============================================================================
# Combine files, make script file, run birrp
#===============================================================================
#if you find that your responses are not scaled correctly, change the parameter
#ffactor which multiplies the responses by that number. This might happen if the
#gains are not quite right or the dipole lengths are not quite right.
#
flstall=[]
for ii,pdict in enumerate(plst[235:]):
try:
flst=brp.runBIRRPpp(dirpath,pdict,stationinfofile,birrploc,
ffactor=1,edipath=edipath)
flstall.append(flst)
except ValueError:
print 'Did not run ',pdict['station'],pdict['day'],pdict['start']