forked from aringler-usgs/syncomppython
-
Notifications
You must be signed in to change notification settings - Fork 0
/
syncompcron.py
executable file
·60 lines (43 loc) · 1.42 KB
/
syncompcron.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/env python
import glob, os
debug = True
#Here is where you can have the results placed. You will need to change this
resdir = '/home/aringler/synthetics/results'
#Here is where the synthetics reside. You probably do not need to change this
syndir = '/SYNTHETICS'
#Here is the path to where syncomp.py resides this will be in your local git repostiry
syncompdir = '/home/aringler/synthetics/syncomppython'
nets = ['IU','IC','CU','US','IW','NE','II']
if debug:
syndirs = glob.glob('/SYNTHETICS/*/*')
else:
syndirs = glob.glob('SYNTHETICS/*/*')
dondirs = glob.glob(resdir)
if debug:
print syndirs
print dondirs
curdir = os.getcwd()
for event in syndirs:
dirinfo = event.split('/')
if not os.path.exists(resdir + '/' + dirinfo[2]):
if debug:
print 'need to make a directory'
os.system('mkdir ' + resdir + '/' + dirinfo[2])
chgdir = resdir + '/' + dirinfo[2]
os.chdir(chgdir)
if debug:
print 'New directory: ' + chgdir
for curnet in nets:
if debug:
print 'Current network: ' + curnet
chkpath = resdir + '/' + dirinfo[2] + '/' + \
dirinfo[3] + '/Results' + dirinfo[3] + curnet + '.csv'
if debug:
print 'Here is the path we are checking: ' + chkpath
if not os.path.exists(chkpath):
runsyn = syncompdir + '/syncomp.py ' + syndir + '/' + dirinfo[2] + \
'/' + dirinfo[3] + ' ' + dirinfo[3] + ' ' + curnet
if debug:
print 'Running: ' + runsyn
os.system(runsyn)
os.chdir(curdir)