Ignore:
Timestamp:
02/04/13 06:10:54 (12 years ago)
Author:
Daniela Dorner
Message:
fill moon info only if available
File:
1 edited

Legend:

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

    r14195 r14848  
    33# option
    44doupdate="yes" # update all entries (needed when new fields have been added)
    5 #doupdate="no" # fill only entries which are not yet existing (default)
     5doupdate="no" # fill only entries which are not yet existing (default)
    66
    77source `dirname $0`/../Sourcefile.sh
     
    1313# get last 3, 6 or 9 nights
    1414dates=( `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"` \
     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"` \
    1717        )
    1818dates=( `find $auxdata -mindepth 3 -type d | sort -r | sed "s/\${auxdata_for_sed}//g" | sed -e 's/^\///'` )
     
    3333   # get file numbers from DB
    3434   #   but only for not-corrupted files
    35    query="SELECT fRunID from RunInfo WHERE fNight="$runnumber" AND NOT ISNULL(fRightAscension) AND NOT ISNULL(fDeclination) "
     35   #query="SELECT fRunID from RunInfo WHERE fNight="$runnumber" AND NOT ISNULL(fRightAscension) AND NOT ISNULL(fDeclination) "
     36   query="SELECT fRunID from RunInfo WHERE fNight="$runnumber" AND NOT ISNULL(fRunStart) "
    3637   #query=$query" AND fRunTypeKEY=6 "
    3738   if [ "$doupdate" = "no" ]
     
    5455     
    5556      # get input info from DB
    56       query="SELECT fRightAscension, fDeclination, fRunStart from RunInfo "
     57      query="SELECT if (isnull(fRightAscension), 999, fRightAscension), "
     58      query=$query" if (isnull(fDeclination), 999, fDeclination), "
     59      query=$query" fRunStart from RunInfo "
    5760      query=$query" WHERE fNight="$runnumber" AND fRunID="$filenum
    5861      info=( `sendquery` )
    5962      echo ${info[@]}
    6063      #echo "/home/fact/FACT++.db/moon "${info[2]} ${info[3]}" --ra=${info[0]} --dec=${info[1]} 2>/dev/null"
    61       lightinfo=( `/home/fact/FACT++.db/moon "${info[2]} ${info[3]}" --ra=${info[0]} --dec=${info[1]} 2>/dev/null` )
     64      if [ "${info[0]}" == "999" ] && [ "${info[1]}" == "999" ]
     65      then
     66         lightinfo=( `/home/fact/FACT++.upgrade/moon "${info[2]} ${info[3]}" 2>/dev/null` )
     67      else
     68         lightinfo=( `/home/fact/FACT++.upgrade/moon "${info[2]} ${info[3]}" --ra=${info[0]} --dec=${info[1]} 2>/dev/null` )
     69      fi
     70      # return values of the programm
     71      # timestamp sunzd moon-visible moondisk moonzd angletomoon angletosun
    6272      echo ${lightinfo[@]}
    6373     
    6474      # build query to update runinfo in DB
    65       query="UPDATE RunInfo SET fSunZenithDistance="${lightinfo[2]}", fMoonDisk="${lightinfo[4]}", fMoonZenithDistance="${lightinfo[5]}", fAngleToMoon="${lightinfo[6]}
     75      query="UPDATE RunInfo SET fSunZenithDistance="${lightinfo[2]}", fMoonDisk="${lightinfo[4]}
     76      query=$query", fMoonZenithDistance="${lightinfo[5]}
     77      echo $query
     78      if [ "${info[0]}" != "999" ] && [ "${info[1]}" != "999" ]
     79      then
     80         query=$query", fAngleToMoon="${lightinfo[6]}
     81         query=$query", fAngleToSun="${lightinfo[7]}
     82      fi
    6683      # add where condition
    6784      query=$query" WHERE fNight="$runnumber" AND fRunID="$filenum
    6885      echo $query
    69      
    7086      # send query to DB
    7187      sendquery >/dev/null
Note: See TracChangeset for help on using the changeset viewer.