def main(): #=============================================================================== # Input files #=============================================================================== arglist = sys.argv[1:] if len(arglist) < 4: sys.exit('ERROR - provide 4 arguments:<station folder directory> <processingparameter file> <stationparameter file> <BIRRP executable>') #directory where station folders are dirpath = op.abspath(arglist[0]) #file where all the processing parameters are, ie day, start time, end time #and birrp parameters like tbw, thetae, etc processinginfofile = op.abspath(arglist[1]) #file where the station info is, ie lat, long, ex, ey, notes stationinfofile = op.abspath(arglist[2]) #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]) #this is the index of which station to process which corresponds to the #line number in Notepad++ minus 2 of the processinginfofile. So if you want #to process the first station in processinginfofile which is line 2 in the #notepad file, the statinindex will be 0. stationindex=0 #=============================================================================== # #get information from the processing file and put into a list of dictionaries #=============================================================================== plst=brp.readProDict(processinginfofile,dirpath) #=============================================================================== # 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. #flst=brp.runBIRRPpp(dirpath,plst[stationindex],stationinfofile,birrploc, # ffactor=1) # #if you want to run multiple stations, one after the other uncomment the #following loop. This will processes the station then plot the apparent #resistivity and phase of all 4 components, then plot the phase tensor #components. If you want to start plst from a different index, because you #keep adding to the processinginfofile for each day, which I suggest doing so #when you come back from the field all the info is one place, just change #the plst in enumrate(plst,1) to plst[start:stop] or plst[start:] for all #stations after start. flstall=[] for ii,pdict in enumerate(plst,1): try: flst=brp.runBIRRPpp(dirpath,pdict,stationinfofile,birrploc, ffactor=1) flstall.append(flst) brp.plotBFfiles(flst['edifile'],cohfile=flst['cohfile'],save='y', show='n') # z1=Z.Z(flst['edifile']) # z1.plotResPhase(fignum=ii,plottype=2) # z1.plotPTAll(fignum=ii+len(plst)) except TypeError: print 'Did not process ',pdict['station'] except IOError: print 'Did not process ',pdict['station'] except IndexError: print 'Did not process ',pdict['station'] except ValueError: print 'Did not process ',pdict['station'] #=============================================================================== # Plot files #=============================================================================== #change save='n' to save='y' if want to save the plots, will save in a folder #called dirpath\plots #if you don't want to use the save icon in the plots you can type in the #interpreter plt.savefig(FullPathSaveName,fmt='pdf) #note that fmt can be jpg, eps, or svg #brp.plotBFfiles(flst['edifile'],cohfile=flst['cohfile'],save='n',show='y') #if this doesn't work try: #mtplot.plotResPhase(flst['edifile'],plotnum=2,fignum=1) #or #z1=Z.Z(flst['edifile']) #z1.plotResPhase(fignum=1,plottype=2) #z1.plotPTAll(fignum=2 if __name__ == '__main__': main()
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'])
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']