From 092572bfc786c33dd462a65271598ef1edd05ccd Mon Sep 17 00:00:00 2001 From: Elena.Budnik Date: Mon, 20 Feb 2017 15:14:38 +0100 Subject: [PATCH] new args, internal planets --- Bin.py/run.py | 27 ++++++++++++++++++++------- runAll | 13 +++++++++++++ runRequest | 11 ++++++++--- 3 files changed, 41 insertions(+), 10 deletions(-) create mode 100755 runAll diff --git a/Bin.py/run.py b/Bin.py/run.py index a47f282..5146b37 100755 --- a/Bin.py/run.py +++ b/Bin.py/run.py @@ -14,10 +14,11 @@ def main(): J2000REF = 946679400 # 2000-01-01T00:00:00 -30min # CHECK ARGS - checkArgs(3, 'Usage : python run.py (target) (Solar Wind XML config file)') + checkArgs(4, 'Usage : python run.py (target) (Solar Wind XML config file) (SwStopTime ISO [ -1 if previous years run])') prefix = sys.argv[1] xmlFile = sys.argv[2] + swStop = sys.argv[3] start_time = myTime.time() @@ -54,12 +55,20 @@ def main(): marginPlasma = getMarginDays(prefix) #Days plasmaStart = shiftedDate(start, days=-marginPlasma, seconds=-1) plasmaDDStart = time2ddtime(plasmaStart) - # if run run.py 'alone' - for previous years + + if swStop == '-1' : + plasmaStop = shiftedDate(stop, days=marginPlasma) + else : + if (shiftedDate(stop, days=marginPlasma) >= swStop ) : + plasmaStop = swStop + else : + plasmaStop = shiftedDate(stop, days=marginPlasma) + # if run run.py 'alone' - for previous years #plasmaStop = shiftedDate(stop, days=marginPlasma) - plasmaStop = shiftedDate(stop) + #plasmaStop = shiftedDate(swStop) plasmaDDStop = time2ddtime(plasmaStop) ddTimeDeltaPlasma = DDTimeDelta(plasmaStart, plasmaStop) - + marginOrbit = 20 # Hours orbitsStart = shiftedDate(plasmaStart, hours=-marginOrbit) orbitsStop = shiftedDate(plasmaStop, hours=marginOrbit) @@ -166,7 +175,11 @@ def main(): combined = plasma.join(source,how='outer').join(target,how='outer') # trunk = combined.truncate(before=start, after=stop) - trunk = combined.truncate(after=stop) + if (prefix == 'venus' or prefix == 'mercury') : + trunk = combined.truncate(before=start) + else : + trunk = combined.truncate(after=stop) + df = trunk.groupby(trunk.index).first() df = df.resample('1H') @@ -238,7 +251,7 @@ def main(): outputs = pd.DataFrame(data=outputsData.T,columns=outputsColumns) outputs = outputs.set_index('Time') - outputs = outputs.truncate(before=start) + outputs = outputs.truncate(before=start, after=stop) outputs.to_csv(MYDIR+'/myOutputs.txt',date_format='%Y-%m-%dT%H:%M:%S',float_format="%.2f",header=False, sep=" ") @@ -447,7 +460,7 @@ def writeNamelist(directory,idprop,xmax1,xmin1): nl.write(' fdirtmp=\''+directory+'/\'\n') nl.write(' instop=0\n') nl.write(' dtr=90.\n') - nl.write(' touts=60.\n') + nl.write(' touts=40.\n') nl.write(' xmin1='+str(xmin1)+'\n') nl.write(' xmax1='+str(xmax1)+'\n') nl.write('/\n') diff --git a/runAll b/runAll new file mode 100755 index 0000000..1b35f02 --- /dev/null +++ b/runAll @@ -0,0 +1,13 @@ +#!/bin/bash + +for request in Requests/venus*.xml + do + if [[ -f $request ]] + then + python Bin.py/run.py venus $request -1 + else + echo -100 + fi + + done + \ No newline at end of file diff --git a/runRequest b/runRequest index 6a5d1f9..7b853b3 100755 --- a/runRequest +++ b/runRequest @@ -11,6 +11,9 @@ SwStop=$4 IFS='_' read -r -a array <<< "$tgt_vi" tgt=${array[0]} + IFS='_' read -r -a array <<< "$src_vi" + src=${array[0]} + # delete results of previous calculations rm -rf $SW2NC/$tgt* $SW2DATA/$src/$tgt* @@ -21,15 +24,17 @@ SwStop=$4 DDLogin $DDUSER $DDPWD >> log - # run newly created Request + # run newly created Request - ONLY FIRST ONE ! # can be launched as stand alone executable for request in $REQ/$tgt*.xml do if [[ -f $request ]] then - python run.py $tgt $request & echo $! + python run.py $tgt $request $SwStop & echo $! else echo -100 - fi + fi + # run only first request !!!! + exit done \ No newline at end of file -- libgit2 0.21.2