Changeset 16987


Ignore:
Timestamp:
07/30/13 13:14:35 (11 years ago)
Author:
Daniela Dorner
Message:
choose dates depending on hour, treat case that rawfile not available anymore
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DataCheck/QuickLook/Step2a.sh

    r16677 r16987  
    66if [ "$1" = "" ]
    77then
     8   hour=`date +%k`
    89   # get date (before 18h there is no new data to be processed)
    9    datepaths=( `date --date="-18HOUR" +%Y/%m/%d` )
    10    datepaths=( `find -L $datapath/star -mindepth 3 -type d | sort -r | sed "s/\${datapath_for_sed}\/star//g" | sed -e 's/^\///'` ) #all available dates in star-directory
     10   if [ $hour -le 7 ] || [ $hour -ge 19 ]
     11   then
     12      datepaths=( `date --date="-19HOUR" +%Y/%m/%d` )
     13   else
     14      datepaths=( `date +%Y/%m/%d --date="-12hour"` `date +%Y/%m/%d --date="-36hour"` `date +%Y/%m/%d --date="-60hour"` \
     15              `date +%Y/%m/%d --date="-84hour"` `date +%Y/%m/%d --date="-108hour"` `date +%Y/%m/%d --date="-132hour"` \
     16#              `date +%Y/%m/%d --date="-156hour"` `date +%Y/%m/%d --date="-180hour"` `date +%Y/%m/%d --date="-204hour"` \
     17              )
     18   fi
     19   #datepaths=( `find -L $datapath/star -mindepth 3 -type d | sort -r | sed "s/\${datapath_for_sed}\/star//g" | sed -e 's/^\///'` ) #all available dates in star-directory
    1120else
    1221   datepaths=( $1 )
    1322fi
    1423
    15 echo ${datepaths[@]}
    16 
    1724for datepath in ${datepaths[@]}
    1825do
    1926   printprocesslog "INFO processing "$datepath
    20    echo "INFO processing "$datepath
     27   #echo "INFO processing "$datepath
    2128   night=`echo $datepath | sed -e 's/\///g'`
    2229   
     
    6976         night=`basename ${files[$i-1]} | cut -d_ -f1`
    7077         runid=`basename ${files[$i-1]} | cut -d_ -f2 | cut -d. -f1`
    71          #echo "night: "$night
    72          #echo "runid: "$runid
     78         drivefile=$auxdata"/"$datepath"/"`basename ${files[$i-1]} | cut -d_ -f1`".DRIVE_CONTROL_SOURCE_POSITION.fits"
    7379         rawfilepath=$rawdata"/"$datepath"/"
    7480         rawfilename=`basename ${files[$i-1]} | sed -e 's/_I.root/.fits/'`
    75          #echo $rawfilepath
    76          #echo $rawfilename
    77          rawfile=`find $rawfilepath -name $rawfilename*`
    78          printprocesslog "INFO processing "$rawfile
    79          drivefile=$auxdata"/"$datepath"/"`basename ${files[$i-1]} | cut -d_ -f1`".DRIVE_CONTROL_SOURCE_POSITION.fits"
    80          printprocesslog "INFO getting coordinates from "$drivefile
    81          tstopi=`$factpath/fitsdump -h $rawfile  2>/dev/null | grep TSTOPI | grep -E -o '[0-9]+'`
    82          tstopf=`$factpath/fitsdump -h $rawfile  2>/dev/null | grep TSTOPF | grep -E -o '[.][0-9]+'`
    83          tstop=${tstopi}${tstopf}
     81         rawfile=`find $rawfilepath -name $rawfilename* 2>/dev/null`
     82         if ! [ "$rawfile" == "" ]
     83         then
     84            printprocesslog "INFO processing "$rawfile
     85            tstopi=`$factpath/fitsdump -h $rawfile  2>/dev/null | grep TSTOPI | grep -E -o '[0-9]+'`
     86            tstopf=`$factpath/fitsdump -h $rawfile  2>/dev/null | grep TSTOPF | grep -E -o '[.][0-9]+'`
     87            tstop=${tstopi}${tstopf}
     88         fi
    8489         #echo "tstop: "$tstop
    85          if ls $drivefile >/dev/null 2>&1
    86             then
     90         if [ ls $drivefile >/dev/null 2>&1 ] && ! [ "$tstop" == "" ]
     91         then
     92            printprocesslog "INFO getting coordinates from "$drivefile
    8793            coordinates=( `${factpath}/fitsdump ${drivefile} -c Ra_src Dec_src -r --filter='Time<'${tstop}  2>/dev/null | tail -1 2>&1` )
    8894            if [ "${coordinates[0]}" == "" ] || [ "${coordinates[1]}" == "" ]
     
    99105            fi
    100106         else
    101             printprocesslog "DEBUG coordinates "${coordinates[@]}
    102             #echo "DEBUG coordinates "${coordinates[@]}
     107            printprocesslog "INFO getting coordinates from DB."
    103108            query="SELECT fSourceKEY FROM RunInfo WHERE fNight="$night" AND fRunID="$runid
    104109            sourcekey=`sendquery`
     
    113118            if [ "${coordinates[0]}" == "" ] || [ "${coordinates[1]}" == "" ]
    114119            then
    115                printprocesslog "WARN couldn't get coordinates ("${coordinates[@]}") from "$drivefile
     120               printprocesslog "WARN couldn't get coordinates ("${coordinates[@]}") from DB."
    116121               #echo "WARN couldn't get coordinates ("${coordinates[@]}") from "$drivefile
    117122               continue
     
    133138         else
    134139            `dirname $0`/RunGanymed.sh $dsfile ${coordinates[0]} ${coordinates[1]}
     140            #echo "ganymed for "$dsfile" "${coordinates[0]}" "${coordinates[1]}
    135141         fi
    136142         numganymeds=`echo " $numganymeds + 1 " | bc -l`
Note: See TracChangeset for help on using the changeset viewer.