Commit 092572bfc786c33dd462a65271598ef1edd05ccd
1 parent
8bc6888e
Exists in
master
new args, internal planets
Showing
3 changed files
with
41 additions
and
10 deletions
Show diff stats
Bin.py/run.py
... | ... | @@ -14,10 +14,11 @@ def main(): |
14 | 14 | J2000REF = 946679400 # 2000-01-01T00:00:00 -30min |
15 | 15 | |
16 | 16 | # CHECK ARGS |
17 | - checkArgs(3, 'Usage : python run.py (target) (Solar Wind XML config file)') | |
17 | + checkArgs(4, 'Usage : python run.py (target) (Solar Wind XML config file) (SwStopTime ISO [ -1 if previous years run])') | |
18 | 18 | |
19 | 19 | prefix = sys.argv[1] |
20 | 20 | xmlFile = sys.argv[2] |
21 | + swStop = sys.argv[3] | |
21 | 22 | |
22 | 23 | start_time = myTime.time() |
23 | 24 | |
... | ... | @@ -54,12 +55,20 @@ def main(): |
54 | 55 | marginPlasma = getMarginDays(prefix) #Days |
55 | 56 | plasmaStart = shiftedDate(start, days=-marginPlasma, seconds=-1) |
56 | 57 | plasmaDDStart = time2ddtime(plasmaStart) |
57 | - # if run run.py 'alone' - for previous years | |
58 | + | |
59 | + if swStop == '-1' : | |
60 | + plasmaStop = shiftedDate(stop, days=marginPlasma) | |
61 | + else : | |
62 | + if (shiftedDate(stop, days=marginPlasma) >= swStop ) : | |
63 | + plasmaStop = swStop | |
64 | + else : | |
65 | + plasmaStop = shiftedDate(stop, days=marginPlasma) | |
66 | + # if run run.py 'alone' - for previous years | |
58 | 67 | #plasmaStop = shiftedDate(stop, days=marginPlasma) |
59 | - plasmaStop = shiftedDate(stop) | |
68 | + #plasmaStop = shiftedDate(swStop) | |
60 | 69 | plasmaDDStop = time2ddtime(plasmaStop) |
61 | 70 | ddTimeDeltaPlasma = DDTimeDelta(plasmaStart, plasmaStop) |
62 | - | |
71 | + | |
63 | 72 | marginOrbit = 20 # Hours |
64 | 73 | orbitsStart = shiftedDate(plasmaStart, hours=-marginOrbit) |
65 | 74 | orbitsStop = shiftedDate(plasmaStop, hours=marginOrbit) |
... | ... | @@ -166,7 +175,11 @@ def main(): |
166 | 175 | combined = plasma.join(source,how='outer').join(target,how='outer') |
167 | 176 | |
168 | 177 | # trunk = combined.truncate(before=start, after=stop) |
169 | - trunk = combined.truncate(after=stop) | |
178 | + if (prefix == 'venus' or prefix == 'mercury') : | |
179 | + trunk = combined.truncate(before=start) | |
180 | + else : | |
181 | + trunk = combined.truncate(after=stop) | |
182 | + | |
170 | 183 | df = trunk.groupby(trunk.index).first() |
171 | 184 | |
172 | 185 | df = df.resample('1H') |
... | ... | @@ -238,7 +251,7 @@ def main(): |
238 | 251 | outputs = pd.DataFrame(data=outputsData.T,columns=outputsColumns) |
239 | 252 | outputs = outputs.set_index('Time') |
240 | 253 | |
241 | - outputs = outputs.truncate(before=start) | |
254 | + outputs = outputs.truncate(before=start, after=stop) | |
242 | 255 | |
243 | 256 | outputs.to_csv(MYDIR+'/myOutputs.txt',date_format='%Y-%m-%dT%H:%M:%S',float_format="%.2f",header=False, sep=" ") |
244 | 257 | |
... | ... | @@ -447,7 +460,7 @@ def writeNamelist(directory,idprop,xmax1,xmin1): |
447 | 460 | nl.write(' fdirtmp=\''+directory+'/\'\n') |
448 | 461 | nl.write(' instop=0\n') |
449 | 462 | nl.write(' dtr=90.\n') |
450 | - nl.write(' touts=60.\n') | |
463 | + nl.write(' touts=40.\n') | |
451 | 464 | nl.write(' xmin1='+str(xmin1)+'\n') |
452 | 465 | nl.write(' xmax1='+str(xmax1)+'\n') |
453 | 466 | nl.write('/\n') | ... | ... |
runRequest
... | ... | @@ -11,6 +11,9 @@ SwStop=$4 |
11 | 11 | IFS='_' read -r -a array <<< "$tgt_vi" |
12 | 12 | tgt=${array[0]} |
13 | 13 | |
14 | + IFS='_' read -r -a array <<< "$src_vi" | |
15 | + src=${array[0]} | |
16 | + | |
14 | 17 | # delete results of previous calculations |
15 | 18 | rm -rf $SW2NC/$tgt* $SW2DATA/$src/$tgt* |
16 | 19 | |
... | ... | @@ -21,15 +24,17 @@ SwStop=$4 |
21 | 24 | DDLogin $DDUSER $DDPWD >> log |
22 | 25 | |
23 | 26 | |
24 | - # run newly created Request | |
27 | + # run newly created Request - ONLY FIRST ONE ! | |
25 | 28 | # can be launched as stand alone executable |
26 | 29 | for request in $REQ/$tgt*.xml |
27 | 30 | do |
28 | 31 | if [[ -f $request ]] |
29 | 32 | then |
30 | - python run.py $tgt $request & echo $! | |
33 | + python run.py $tgt $request $SwStop & echo $! | |
31 | 34 | else |
32 | 35 | echo -100 |
33 | - fi | |
36 | + fi | |
37 | + # run only first request !!!! | |
38 | + exit | |
34 | 39 | done |
35 | 40 | |
36 | 41 | \ No newline at end of file | ... | ... |