From 6676484a6142e891e270395505c5a696a93e5251 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludger=20K=C3=BCperkoch?= Date: Tue, 27 Oct 2015 16:51:42 +0100 Subject: [PATCH] Debuged: Avoids writing multiple LOCFILES-command lines if same event is processed several times. --- autoPyLoT.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/autoPyLoT.py b/autoPyLoT.py index d073f4ea..9ae760f7 100755 --- a/autoPyLoT.py +++ b/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])