From af16ae5a09dae862fb520e2acc7b4711b5e38019 Mon Sep 17 00:00:00 2001 From: Elena.Budnik Date: Thu, 19 Oct 2017 10:38:20 +0200 Subject: [PATCH] 2 angles + Templates --- Bin.py/run.py | 12 ++++++++---- Sources/get_OMNI_1H.cpp | 4 ++-- Templates/jupiter_XXXX.xml | 12 ++++++++++++ Templates/mars_XXXX.xml | 12 ++++++++++++ Templates/mercury_XXXX.xml | 12 ++++++++++++ Templates/saturn_XXXX.xml | 12 ++++++++++++ Templates/venus_XXXX.xml | 12 ++++++++++++ runAll | 30 ++++++++++++++++++++---------- 8 files changed, 90 insertions(+), 16 deletions(-) create mode 100644 Templates/jupiter_XXXX.xml create mode 100644 Templates/mars_XXXX.xml create mode 100644 Templates/mercury_XXXX.xml create mode 100644 Templates/saturn_XXXX.xml create mode 100644 Templates/venus_XXXX.xml diff --git a/Bin.py/run.py b/Bin.py/run.py index 1f7f248..7aafdde 100755 --- a/Bin.py/run.py +++ b/Bin.py/run.py @@ -87,7 +87,8 @@ def main(): plasmaCmd = ['get_OMNI_1H',MYDIR+'/plasma.csv',plasmaDDStart,ddTimeDeltaPlasma] elif plasmaVi == 'ace_swepam_real': plasmaCmd = ['get_ACE_RT',MYDIR+'/plasma.csv',MYDIR+'/mag.csv',plasmaDDStart,ddTimeDeltaPlasma] - + + print plasmaCmd srcCmd = ['get_R_LON_HCI',MYDIR+'/source.csv',srcVi,srcR,srcLon,orbitsDDStart,ddTimeDeltaOrbit] tgtCmd = ['get_R_LON_HCI',MYDIR+'/target.csv',tgtVi,tgtR,tgtLon,orbitsDDStart,ddTimeDeltaOrbit] os.system(' '.join(plasmaCmd)) @@ -136,7 +137,10 @@ def main(): target = target.set_index('Time') # CARTESIAN TO SPHERICAL COORDS + + #r_source = source['R_HCI_source'] / 150000000.0 r_source = source['R_HCI_source'] + lon_source_deg = np.degrees(source['LON_HCI_source']) lon_source_deg[lon_source_deg < 0] = lon_source_deg+360.0 #-180/180 -> 0/360 @@ -302,7 +306,7 @@ def main(): temperatureVar = nc.createVariable( 'T', 'f4', (u'Time',) ) tempKelvin = [ tempi/11600.0 for tempi in np.array(outputs['Temperature']) ] - temperatureVar.units = 'K' + temperatureVar.units = 'eV' temperatureVar[:] = tempKelvin deltaPhiVar = nc.createVariable( 'Delta_angle', 'f4', (u'Time',) ) @@ -459,8 +463,8 @@ def writeNamelist(directory,idprop,xmax1,xmin1): nl.write(' idp_prop=1\n') nl.write(' idp_out=1\n') #nl.write(' angref(1)=0.,30.,60.,90.,120.,150.,180.,210.,240.,270.,300.,330.\n') - nl.write(' angref(1)=0.,60.,120.,180.,240.,300.\n') - #nl.write(' angref(1)=0.,60.\n') + #nl.write(' angref(1)=0.,60.,120.,180.,240.,300.\n') + nl.write(' angref(1)=0.,180.\n') nl.write(' idprop='+str(idprop)+'\n') nl.write(' fnin=\''+directory+'/inputs.txt\'\n') nl.write(' fnout=\''+directory+'/outputs.txt\'\n') diff --git a/Sources/get_OMNI_1H.cpp b/Sources/get_OMNI_1H.cpp index 8b1fda2..90c3399 100644 --- a/Sources/get_OMNI_1H.cpp +++ b/Sources/get_OMNI_1H.cpp @@ -38,7 +38,7 @@ int main(int argc, char const *argv[]) ofstream plasmaFile(dataFilename.c_str(), ios::out); int id = DD_SetVariable( const_cast( plasmaVi.c_str() ) ); - + char *st = const_cast( ddStart.c_str() ); int error = DD_SetTime(id, st); @@ -46,7 +46,7 @@ int main(int argc, char const *argv[]) if (error < 0) { std::string ddSetTimeErr = "[ERROR] Bad time pointer init in DD_SetTime -> err value : " + error; - throw std::string(ddSetTimeErr); + throw ddSetTimeErr; } // GET DATA diff --git a/Templates/jupiter_XXXX.xml b/Templates/jupiter_XXXX.xml new file mode 100644 index 0000000..d521a82 --- /dev/null +++ b/Templates/jupiter_XXXX.xml @@ -0,0 +1,12 @@ + + + XXXX-01-01T00:00:00 + YYYY-01-01T00:00:00 + omni_hour_all + earth_orb_all + R + LON_HCI + jupiter_orb_all + R_HCI + LON_HCI + \ No newline at end of file diff --git a/Templates/mars_XXXX.xml b/Templates/mars_XXXX.xml new file mode 100644 index 0000000..39350f4 --- /dev/null +++ b/Templates/mars_XXXX.xml @@ -0,0 +1,12 @@ + + + XXXX-01-01T00:00:00 + YYYY-01-01T00:00:00 + omni_hour_all + earth_orb_all + R + LON_HCI + mars_orb_all + R_HCI + LON_HCI + \ No newline at end of file diff --git a/Templates/mercury_XXXX.xml b/Templates/mercury_XXXX.xml new file mode 100644 index 0000000..9264b08 --- /dev/null +++ b/Templates/mercury_XXXX.xml @@ -0,0 +1,12 @@ + + + XXXX-01-01T00:00:00 + YYYY-01-01T00:00:00 + omni_hour_all + earth_orb_all + R + LON_HCI + mercury_orb_all + R_HCI + LON_HCI + \ No newline at end of file diff --git a/Templates/saturn_XXXX.xml b/Templates/saturn_XXXX.xml new file mode 100644 index 0000000..332c352 --- /dev/null +++ b/Templates/saturn_XXXX.xml @@ -0,0 +1,12 @@ + + + XXXX-01-01T00:00:00 + YYYY-01-01T00:00:00 + omni_hour_all + earth_orb_all + R + LON_HCI + saturn_orb_all + R_HCI + LON_HCI + \ No newline at end of file diff --git a/Templates/venus_XXXX.xml b/Templates/venus_XXXX.xml new file mode 100644 index 0000000..1419fd3 --- /dev/null +++ b/Templates/venus_XXXX.xml @@ -0,0 +1,12 @@ + + + XXXX-01-01T00:00:00 + YYYY-01-01T00:00:00 + omni_hour_all + earth_orb_all + R + LON_HCI + venus_orb_all + R_HCI + LON_HCI + \ No newline at end of file diff --git a/runAll b/runAll index 1b35f02..9d1e91c 100755 --- a/runAll +++ b/runAll @@ -1,13 +1,23 @@ #!/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 +for i in `seq 0 5` + do + YEAR=$((i + 2010)) + YEAR_STOP=$((YEAR + 1)) + echo $YEAR_STOP + + for template in Templates/venus_XXXX.xml + do + if [[ -f $template ]] + then + IFS='_/. ' read -r -a array <<< $template + target=${array[1][1]} + request=$target"_"$YEAR".xml" + sed "s/XXXX/$YEAR/g;s/YYYY/$YEAR_STOP/g" $template > Requests/$request + python Bin.py/run.py $target Requests/$request $YEAR_STOP-01-01T00:00:00.000Z + else + echo -100 + fi + done + done \ No newline at end of file -- libgit2 0.21.2