Debuged: Avoids writing multiple LOCFILES-command lines if same event is processed several times.
This commit is contained in:
		
							parent
							
								
									d5b3a7d40f
								
							
						
					
					
						commit
						6676484a61
					
				
							
								
								
									
										13
									
								
								autoPyLoT.py
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								autoPyLoT.py
									
									
									
									
									
								
							@ -7,7 +7,7 @@ import argparse
 | 
			
		||||
import glob
 | 
			
		||||
import subprocess
 | 
			
		||||
import matplotlib.pyplot as plt
 | 
			
		||||
 | 
			
		||||
import pdb
 | 
			
		||||
from obspy.core import read
 | 
			
		||||
from pylot.core.read.data import Data
 | 
			
		||||
from pylot.core.read.inputs import AutoPickParameter
 | 
			
		||||
@ -157,11 +157,12 @@ def autoPyLoT(inputfile):
 | 
			
		||||
            filedata = None
 | 
			
		||||
            nllfile = open(locfile, 'r')
 | 
			
		||||
            filedata = nllfile.read()
 | 
			
		||||
            # replace old command
 | 
			
		||||
            filedata = filedata.replace('LOCFILES', locfiles)
 | 
			
		||||
            nllfile = open(locfile, 'w')
 | 
			
		||||
            nllfile.write(filedata)
 | 
			
		||||
            nllfile.close()
 | 
			
		||||
            if filedata.find(locfiles) < 0:
 | 
			
		||||
                # replace old command
 | 
			
		||||
            	filedata = filedata.replace('LOCFILES', locfiles)
 | 
			
		||||
            	nllfile = open(locfile, 'w')
 | 
			
		||||
            	nllfile.write(filedata)
 | 
			
		||||
            	nllfile.close()
 | 
			
		||||
 | 
			
		||||
            # locate the event
 | 
			
		||||
            subprocess.call([nlloccall, locfile])
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user