[fix] be sure to start the external programs in the right directory

This commit is contained in:
Sebastian Wehling-Benatelli 2016-08-03 13:28:54 +02:00
parent c13bdd2cf2
commit 471cfe755b

View File

@ -49,7 +49,8 @@ class Tomo3d(object):
os.system('ln -s %s %s'%(filename, linkname))
def buildObsdata(self):
os.system('obsdata')
p = subprocess.Popen(os.path.join(self.cwd, 'obsdata'), shell=True)
os.waitpid(p.pid)
os.system('mv sources.in sourcesref.in')
def defFMMParas(self):
@ -57,9 +58,9 @@ class Tomo3d(object):
Initiates parameters for the forward calculation.
'''
# Name of fast marching program
self.fmm = '{0}/fm3d'.format(self.cwd)
self.fmm = os.path.join(self.cwd, 'fm3d')
# Name of program calculating Frechet derivatives
self.frechgen = '{0}/frechgen'.format(self.cwd)
self.frechgen = os.path.join(self.cwd, 'frechgen')
# Name of current velocity/inversion grid
self.cvg = 'vgrids.in'
# Name of current interfaces grid
@ -116,7 +117,7 @@ class Tomo3d(object):
Default: pwd
'''
if directory == None:
directory = os.path.join(os.getcwd(), self.simuldir)
directory = self.simuldir
os.chdir(directory)
self.cwd = directory