diff --git a/Bin.py/makeRequest.py b/Bin.py/makeRequest.py index d031ae2..2d532be 100644 --- a/Bin.py/makeRequest.py +++ b/Bin.py/makeRequest.py @@ -19,18 +19,18 @@ def checkArgs(nbArgs, message): # In[3]: # CHECK ARGS -checkArgs(6, 'Usage : python makeRequest.py (target) (tgt_vi) (sw_vi) (TaoStopTime) (SwStopTime)') +checkArgs(5, 'Usage : python makeRequest.py (tgt_vi) (sw_vi) (TaoStopTime) (SwStopTime)') -prefix = sys.argv[1] -tgtVI = sys.argv[2] -plasmaVI = sys.argv[3] +prefix = sys.argv[1].split("_")[0] +tgtVI = sys.argv[1] +plasmaVI = sys.argv[2] # In[4]: -omniStopTime = datetime.strptime(sys.argv[5], '%Y-%m-%dT%H:%M:%S') +omniStopTime = datetime.strptime(sys.argv[4], '%Y-%m-%dT%H:%M:%S.000Z') print omniStopTime # In[5]: -missionStopTime = datetime.strptime(sys.argv[4], '%Y-%m-%dT%H:%M:%S.000Z') +missionStopTime = datetime.strptime(sys.argv[3], '%Y-%m-%dT%H:%M:%S.000Z') print missionStopTime # In[6]: @@ -70,7 +70,7 @@ if newMissionStop <= newMissionStart: else: print "Database has to be updated" -if newMissionStart.year != newMissionStop.year: +if newMissionStart.year != newMissionStop.year and plasmaVI != 'ace_swepam_real': print "2 files will be producted" newMissionxml1Start = datetime(newMissionStart.year,1,1,0,0) newMissionxml1Stop = datetime(newMissionStop.year,1,1,0,0) @@ -86,7 +86,10 @@ if newMissionStart.year != newMissionStop.year: writeXMLMission(XMLfilename,newMissionxml2Start.isoformat(),newMissionxml2Stop.isoformat(),plasmaVI,tgtVI,tgtRParam,tgtLonParam) else: print "1 file will be producted" - newMissionxmlStart = datetime(newMissionStart.year,1,1,0,0) + if plasmaVI == "ace_swepam_real": + newMissionxmlStart = datetime(newMissionStart.year,newMissionStart.month,newMissionStart.day,0,0) + else: + newMissionxmlStart = datetime(newMissionStart.year,1,1,0,0) newMissionxmlStop = newMissionStop print 'XML Start : ' + newMissionxmlStart.isoformat() print 'XML Stop : ' + newMissionxmlStop.isoformat() diff --git a/Bin.py/run.py b/Bin.py/run.py index 2ae0f0c..eac8498 100755 --- a/Bin.py/run.py +++ b/Bin.py/run.py @@ -26,10 +26,10 @@ def main(): SW2MISSIONS = os.getenv('REQ') SW2DATA = os.getenv('SW2DATA') SW2NC = os.getenv('SW2NC') - + # GET INFOS FROM XML CONFIG FILE start,stop,plasmaVi,srcVi,srcR,srcLon,tgtVi,tgtR,tgtLon = getXMLConfig(xmlFile) - src = plasmaVi.split('_')[0] + src = plasmaVi.split('_')[0] # CREATE A DIRECTORY FOR THE NEW QUERY MYDIR = SW2DATA+'/'+src+'/'+prefix+'_'+datetime.now().strftime('%Y%m%d') @@ -54,7 +54,8 @@ def main(): marginPlasma = getMarginDays(tgtVi) #Days plasmaStart = shiftedDate(start, days=-marginPlasma, seconds=-1) plasmaDDStart = time2ddtime(plasmaStart) - plasmaStop = shiftedDate(stop, days=marginPlasma) + # if run run.py 'alone' - for previous years + #plasmaStop = shiftedDate(stop, days=marginPlasma) plasmaStop = shiftedDate(stop) plasmaDDStop = time2ddtime(plasmaStop) ddTimeDeltaPlasma = DDTimeDelta(plasmaStart, plasmaStop) @@ -179,7 +180,7 @@ def main(): xmin1 = 0.3 else: idprop = 1 - xmax1 = 10.8 + xmax1 = 5.8 xmin1 = 0.8 # QUALITY FLAG @@ -342,9 +343,9 @@ def getXMLConfig(XMLFilename): def getMarginDays(tgtName): if tgtName == 'mercury': - distAU == 0.48 + distAU == 0.61 elif tgtName == 'venus': - distAU = 0.48 + distAU = 0.28 elif tgtName == 'mars': distAU = 0.52 elif tgtName == 'jupiter': @@ -437,8 +438,8 @@ def writeNamelist(directory,idprop,xmax1,xmin1): nl.write(' fnout=\''+directory+'/outputs.txt\'\n') nl.write(' fdirtmp=\''+directory+'/\'\n') nl.write(' instop=0\n') - nl.write(' dtr=300.\n') - nl.write(' touts=12.\n') + nl.write(' dtr=90.\n') + nl.write(' touts=40.\n') nl.write(' xmin1='+str(xmin1)+'\n') nl.write(' xmax1='+str(xmax1)+'\n') nl.write('/\n') diff --git a/Doc/README b/Doc/README new file mode 100644 index 0000000..9b5f9c1 --- /dev/null +++ b/Doc/README @@ -0,0 +1,10 @@ +from datetime import datetime, date, time, timedelta +import pandas as pd +import numpy as np +import os +import sys +from lxml import etree +from netCDF4 import Dataset +import logging +from logging.handlers import RotatingFileHandler +import time as myTime \ No newline at end of file diff --git a/runRequest b/runRequest index 55ac71f..24503ee 100755 --- a/runRequest +++ b/runRequest @@ -1,27 +1,30 @@ #!/bin/bash # Prepare & Run Request -tgt=$1 # prefix -tgt_vi=$2 -src_vi=$3 -TaoStop=$4 -SwStop=$5 +tgt_vi=$1 +src_vi=$2 +TaoStop=$3 +SwStop=$4 . $(dirname $BASH_SOURCE)/env.sh + IFS='_' read -r -a array <<< "$tgt_vi" + tgt=${array[0]} + # delete results of previous calculations rm -rf $SW2NC/$tgt* $SW2DATA/$src/$tgt* # delete previous requests rm -f $REQ/*.xml - cd $SW2ROOT/Bin.py; python makeRequest.py $tgt $tgt_vi $src_vi $TaoStop $SwStop > log + cd $SW2ROOT/Bin.py; python makeRequest.py $tgt_vi $src_vi $TaoStop $SwStop > log DDLogin $DDUSER $DDPWD >> log # run newly created Request + # can be launched as stand alone executable for request in $REQ/$tgt*.xml do - python run.py $tgt $request & echo $! + python run.py $tgt $request & echo $! done \ No newline at end of file -- libgit2 0.21.2