Ignore:
Timestamp:
09/06/13 15:58:35 (11 years ago)
Author:
Daniela Dorner
Message:
bugfix in regular expression for source name, usage of getdates function, prepared script to be used in RunMoreNights.sh, minor changes
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DataCheck/Processing/FillAuxData.sh

    r17001 r17095  
    2020# trigger rate has as first value -1, but with using the median it should be fine
    2121
    22 # option
    23 doupdate="yes" # update all entries (needed when new fields have been added)
    24 doupdate="no" # fill only entries which are not yet existing (default)
     22# option whether to fill all row or only those where information is missing
     23# $doupdate might be given as environment variable
     24if [ "$doupdate" = "" ]
     25then
     26   doupdate="yes" # update all entries (needed when new fields have been added)
     27   doupdate="no" # fill only entries which are not yet existing (default)
     28fi
    2529
    2630source `dirname $0`/../Sourcefile.sh
    2731printprocesslog "INFO starting $0 with option doupdate="$doupdate
    2832
    29 logfile=$runlogpath"/FillAuxLP-"$datetime".log"
     33logfile=$runlogpath"/FillAuxData-"$datetime".log"
    3034date >> $logfile
    3135
     
    7175      printprocesslog "WARN couldn't get statistics from file $1 for run $date $file"
    7276      rm $tmpfile
    73       finish
     77      continue
     78      #finish
    7479   fi
    7580   #echo "good: "$good
     
    9196fi
    9297
    93 
    94 # get current hour
    95 hour=`date +%k`
    96 if [ $hour -le 7 ] || [ $hour -ge 19 ]
     98# get dates
     99if [ "$certaindate" != "" ]
    97100then
    98    dates=( `date +%Y/%m/%d --date="-12hour"` )
     101   getdates $certaindate
    99102else
    100    # get last 3, 6 or 9 nights
    101    dates=( `date +%Y/%m/%d --date="-12hour"` `date +%Y/%m/%d --date="-36hour"` `date +%Y/%m/%d --date="-60hour"` \
    102            `date +%Y/%m/%d --date="-84hour"` `date +%Y/%m/%d --date="-108hour"` `date +%Y/%m/%d --date="-132hour"` \
    103 #           `date +%Y/%m/%d --date="-156hour"` `date +%Y/%m/%d --date="-180hour"` `date +%Y/%m/%d --date="-204hour"` \
    104            )
     103   # get all night
     104   #getdates "all"
     105   # get last 6 nights if time between 7 and 19h
     106   getdates 6 7 19
    105107fi
    106 #dates=( `find $ziprawdata -mindepth 3 -type d | sort | sed "s/\${ziprawdata_for_sed}//g" | sed -e 's/^\///'` ) #all available dates in /loc_data/zipraw
    107 
    108 #dates=( "2013/06/13")
    109108
    110109printprocesslog "INFO processing the following night(s): "${dates[@]}
     
    160159         printprocesslog "WARN for $sourceposfile fverify returned "$sourceposnumerrors" error(s)."
    161160      fi
     161      sourceposfiletstarti=`$factpath/fitsdump -h $sourceposfile  2>/dev/null | grep 'TSTARTI' | grep -E -o '[0-9]{5}'`
     162      sourceposfiletstartf=`$factpath/fitsdump -h $sourceposfile  2>/dev/null | grep 'TSTARTF' | grep -E -o '0[.][0-9]+'`
     163      if [ $sourceposfiletstarti -gt 30000 ]
     164      then
     165         sourceposfiletstart=`echo " $sourceposfiletstarti + $sourceposfiletstartf - 40587 " | bc -l`
     166      else
     167         sourceposfiletstart=`echo " $sourceposfiletstarti + $sourceposfiletstartf " | bc -l`
     168      fi
     169      #echo "tstart: "$sourceposfiletstart
    162170   fi
    163171   
     
    257265
    258266      # get information from source_pos file
     267      #echo $sourceposfile
    259268      if [ -e $sourceposfile ] && [ $sourceposnumerrors -eq 0 ]
    260269      then
    261270         #sourcename=`${factpath}/fitsdump ${sourceposfile} -c Time -c Name --filter='[1]<'${tstop}  2>/dev/null | tail -1 2>&1 | grep -o -E "['][a-zA-Z0-9\ ]+[']" | sed -e "s/'//g"`
    262271         #sourcename=`/home/fact/FACT++.dbg/fitsdump ${sourceposfile} -c Time -c Name --filter='[1]<'${tstop}  2>/dev/null | tail -1 2>&1 | grep -o -E "['][a-zA-Z0-9\+\-\ ]+[']" | sed -e "s/'//g"`
    263          sourcename=`/home/fact/FACT++.dbg/fitsdump ${sourceposfile} -c Time -c Name --filter='[1]<'${tstop}  2>/dev/null | tail -1 2>&1 | grep -o -E "['][a-zA-Z0-9\ \.\+\-]+[']" | sed -e "s/'//g"`
     272         sourcename=`$factpath/fitsdump ${sourceposfile} -c Time -c Name --filter='[1]<'${tstop}' && [1]>'${sourceposfiletstart}  2>/dev/null | tail -1 2>&1 | grep -o -E "['][a-zA-Z0-9\ \.\+\-]+[']" | sed -e "s/'//g"`
     273         #echo "$factpath/fitsdump ${sourceposfile} -c Time -c Name --filter='[1]<'${tstop} --filter='[1]>'${sourceposfiletstart}  2>/dev/null | tail -1 2>&1 | grep -o -E \"['][a-zA-Z0-9\ \.\+\-]+[']\" | sed -e \"s/'//g\""
    264274         #echo $sourcename
    265275         if [ "$sourcename" == "" ]
     
    268278         else
    269279            query="SELECT fSourceKey FROM Source WHERE fSourceName='"$sourcename"'"
     280            #echo $query
    270281            sourcekey=`sendquery`
    271282            if [ "$sourcename" == "" ]
     
    283294      then
    284295         query=$query" fSourceKey="$sourcekey", "
     296      else
     297         query=$query" fSourceKey=NULL, "
    285298      fi
    286299     
Note: See TracChangeset for help on using the changeset viewer.