/[CCFs]/bin/mlovccf
ViewVC logotype

Diff of /bin/mlovccf

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by ccflib, Tue Mar 10 16:51:28 2015 UTC revision 1.8 by ccflib, Mon Sep 7 13:39:15 2015 UTC
# Line 2  Line 2 
2    
3  # mlovccf (make list of valid ccfs)  # mlovccf (make list of valid ccfs)
4  #  #
5  # Makes the list of valid CCFs that are all CCFs, among those published since the  # Makes the list of valid CCFs. These are all CCFs, among those published since the
6  # beginning of the project, that are required to process any ODF at a given date,  # beginning of the project, that are required to process any ODF at a given date,
7  # typically the current date. Thus, this list will change with time as far as new  # typically the current date. This list will change with time as far as new
8  # CCFs are issued to deal with new calibration data and/or replace obsolete ones.  # CCFs are issued to deal with new calibration data and/or replace obsolete ones.
9  #  #
10  # To identify the set of CCFs required to process a given ODF is the task of cifbuild.  # To identify the set of CCFs required to process a given ODF is the ijob of task cifbuild.
11  # To make such identification, cifbuild needs only the start time of the observation.  # To make such identification, cifbuild needs only the start time of the observation.
12    # Therefore, if we provide a list of all observed ODFs at a given date together with their
13    # respective start time, we could compute all the CCFs required to process them.
14    # For such a moment, that list is the list of valid CCFs required to process
15    # any observed ODF.
16  #  #
17  # If we get the list of required CCFs for all observed ODFs at a given date,  # We need as input the list of all observed ODFs at a given date.
18  # we will obtain for such a moment, the list of valid CCFs required to process  # This is obtained from the report of all observations that the XSA makes to CDS,
 # any observed ODF. Thus, we need as input the list of all observed ODFs at a given  
 # date. This is obtained from the report of all observations that the XSA makes to CDS,  
19  # xsaobslog.txt (ftp://nxsa.esac.esa.int/pub/cfs_obslog/xsaobslog.txt).  # xsaobslog.txt (ftp://nxsa.esac.esa.int/pub/cfs_obslog/xsaobslog.txt).
20  #  #
21  # $Id: mlovccf,v 1.2 2015/03/10 13:27:33 ccflib Exp $  # $Id: mlovccf,v 1.7 2015/08/27 16:47:16 ccflib Exp $
22    
23    # Next two lines allow to submit this script to the grid
24    # request Bourne shell as shell for job
25    #$ -S /bin/bash
26    
27    
28  host=`hostname | cut -d. -f1`  host=`hostname | cut -d. -f1`
29    
30  now=`date +'%Y-%M-%dT%H:%M:%S'`  now=`date +'%Y%m%d_%H%M'`
31    now_table=`date +'%Y-%m-%dT%H:%M:%S'`
32    
33  # Function find_latest_mif to get the latest XMM_CALINDEX from given directory  # Function find_latest_mif to get the latest XMM_CALINDEX from given directory
34    
# Line 72  fdump ${cif_to_process} prhead=no showco Line 80  fdump ${cif_to_process} prhead=no showco
80  VALID_CCF="$HOME/valid_ccf"  VALID_CCF="$HOME/valid_ccf"
81    
82  cd ${VALID_CCF}  cd ${VALID_CCF}
 wget -nc -q ftp://nxsa.esac.esa.int/pub/cds_obslog/xsaobslog.txt  
83    
84    # Remove any xsaobslog.txt previously downloaded.
85    
86    [ -f "xsaobslog.txt" ] && rm -rf xsaobslog.txt
87    
88    # Get the list latest list of ODFs available from nXSA server.
89    
90    wget -q ftp://nxsa.esac.esa.int/pub/cds_obslog/xsaobslog.txt
91    
92    # Rename xsaobslog.txt to xsaobslog_${now}.txt just to have a reference
93    # of which list of ODFs was used to compute the list of valid CCFs.
94    
95    mv xsaobslog.txt xsaobslog_${now}.txt
96    
97  # Sets SAS_CCFPATH and initialises HEADAS and SAS depending on host  # Sets SAS_CCFPATH and initialises HEADAS and SAS depending on host
98    
99  case "$host" in  case "$host" in
100          xvsoc01|xmm)          xvsoc01|xmm)
101                  SAS_CCFPATH="/data/xmm/ccflib/ftp-area/constituents"                  export SAS_CCFPATH="/data/xmm/ccflib/ftp-area/constituents"
102                  SAS_DIR=/data/xmm/ccflib/sas                  export SAS_DIR=/data/xmm/ccflib/sas
103                  SAS_PATH=$SAS_DIR                  export SAS_PATH=$SAS_DIR
104                  source $SAS_DIR/sas-setup.sh                  source $SAS_DIR/sas-setup.sh
105                  ;;                  ;;
106          sasbld01|sasbld02)          sasbld01|sasbld02)
107                  SAS_CCFPATH="/home/ccflib/ftp-area/constituents"                  export SAS_CCFPATH="/home/ccflib/ftp-area/constituents"
108                  /sas/bin/confsas                  /sas/bin/confsas
109                  export HEADAS=/sasbuild/local/${host}/headas/architecture                  export HEADAS=/sasbuild/local/${host}/headas/architecture
110                  . $HEADAS/headas-init.sh                  . $HEADAS/headas-init.sh
111                    # To be able to mix several jobs on the same ccflib account
112                    [ ! -d "${HOME}/pfiles/${host}" ] && mkdir ${HOME}/pfiles/${host}
113                    export PFILES="${HOME}/pfiles/${host};${HEADAS}/syspfiles"
114                    echo -n "HEADAS version: "
115                    fversion
116                  source $HOME/setsas.sh 1> /dev/null                  source $HOME/setsas.sh 1> /dev/null
117                    echo "SAS Version: "
118                    sasversion -V 1
119                  export SAS_VERBOSITY=0                  export SAS_VERBOSITY=0
120                  ;;                  ;;
121            scigrid6|cn-*)
122                    export SAS_CCFPATH="/home/ccflib/ftp-area/constituents"
123                    /sas/bin/confsas
124                    export HEADAS=/sasbuild/local/sasbld02/headas/architecture
125                    . $HEADAS/headas-init.sh
126                    # To be able to mix several jobs on the same ccflib account
127                    [ ! -d "${HOME}/pfiles/${host}" ] && mkdir ${HOME}/pfiles/${host}
128                    export PFILES="${HOME}/pfiles/${host};${HEADAS}/syspfiles"
129                    echo -n "HEADAS version: "
130                    fversion
131                    source $HOME/setsas.sh 1> /dev/null
132                    echo "SAS Version: "
133                    sasversion -V 1
134                    export SAS_VERBOSITY=0
135                    ;;
136            *) echo "Error: Do not know how to do it in host $host" ; exit ;;
137  esac  esac
138    
139  # Finds the latest MIF issue  # Finds the latest MIF issue
# Line 151  do Line 193  do
193          rm ${VALID_CCF}/${obsid}_ccfs.txt          rm ${VALID_CCF}/${obsid}_ccfs.txt
194          rm ${VALID_CCF}/all_ccfs_${now}.tmp          rm ${VALID_CCF}/all_ccfs_${now}.tmp
195    
196  done < ${VALID_CCF}/xsaobslog.txt  done < ${VALID_CCF}/xsaobslog_${now}.txt
197    
198  # Make a table of classes and issues type "Pipeline Release Notes"  # Make a table of classes and issues type "Pipeline Release Notes"
199    
# Line 172  mv ${VALID_CCF}/kk.txt ${ccf_classes} Line 214  mv ${VALID_CCF}/kk.txt ${ccf_classes}
214    
215  total_number_of_ccfs=0  total_number_of_ccfs=0
216    
217  all_ccfs_table="{VALID_CCF}/all_ccfs_${now}_table.txt  all_ccfs_table="${VALID_CCF}/all_ccfs_${now}_table.txt"
218    
219  [ -f "${all_ccfs_table}" ] && rm ${all_ccfs_table}  [ -f "${all_ccfs_table}" ] && rm ${all_ccfs_table}
220    
221  echo "Table of valid CCFs at $now"                      >> ${all_ccfs_table}  echo "Table of valid CCFs at $now_table"                        >> ${all_ccfs_table}
222  echo                                                    >> ${all_ccfs_table}  echo                                                            >> ${all_ccfs_table}
223  echo "|================================|=============|" >> ${all_ccfs_table}  echo "|================================|=============|=======|" >> ${all_ccfs_table}
224  echo "| Calibration File               | Issue range |" >> ${all_ccfs_table}  echo "| Calibration File               | Issue range | Count |" >> ${all_ccfs_table}
225  echo "|================================|=============|" >> ${all_ccfs_table}  echo "|================================|=============|=======|" >> ${all_ccfs_table}
226    
227  while read ccf_class  while read ccf_class
228  do  do
# Line 205  do Line 247  do
247          li=$((10#$last_issue))          li=$((10#$last_issue))
248          fi=$((10#$first_issue))          fi=$((10#$first_issue))
249    
250          sequential_number_of_issues_for_this_class=$(($li - $fi + 1))          sequential_number_of_issues_for_this_class=$((li - fi + 1))
         if [ "${real_number_of_issues_for_this_class}"  -lt "${sequential_number_of_issues_for_this_class}" ] ; then  
                 asterisk="(*)"  
         else  
                 asterisk="   "  
         fi  
         total_number_of_ccfs=$(($real_number_of_issues_for_this_class + $total_number_of_ccfs))  
   
         if [ "${first_issue}" != "${last_issue}" ] ; then  
                 printf "| %-30s | %4s-%4s%3s|\n" ${ccf_class} ${first_issue} ${last_issue} ${asterisk} >> ${all_ccfs_table}  
         else  
                 printf "| %-30s | %4s        |\n" ${ccf_class} ${first_issue}                          >> ${all_ccfs_table}  
         fi  
     
 done < ${ccf_classes}    
251    
252  echo "|================================|=============|"                                                >> ${all_ccfs_table}          asterisk="   "
253  echo                                                                                                   >> ${all_ccfs_table}          [ "${real_number_of_issues_for_this_class}"  -lt "${sequential_number_of_issues_for_this_class}" ] &&  asterisk="(*)"
254  echo "(*): Some issues in the range are not required."                                                 >> ${all_ccfs_table}  
255  rm ${VALID_CCF}/ccf_classes.txt          total_number_of_ccfs=$((real_number_of_issues_for_this_class + total_number_of_ccfs))
 rm ${VALID_CCF}/ccf_issues_for*.txt  
256    
257            rn=$real_number_of_issues_for_this_class
258    
259            if [ "${first_issue}" != "${last_issue}" ] ; then
260               if [ "$asterisk" = "(*)" ] ; then
261                  printf "| %-30s | %4s-%4s(*)|  %4s |\n"  ${ccf_class} ${first_issue} ${last_issue} ${rn}          >> ${all_ccfs_table}
262               else
263                  printf "| %-30s | %4s-%4s   |  %4s |\n"  ${ccf_class} ${first_issue} ${last_issue} ${rn}          >> ${all_ccfs_table}
264               fi
265            else
266               printf "| %-30s | %4s        |  %4s |\n" ${ccf_class} ${first_issue} ${rn}                           >> ${all_ccfs_table}
267            fi
268    
269  echo ; echo "Number of valid CCFs required as of $now : ${total_number_of_ccfs}"          
270            echo "done"
271    done < ${ccf_classes}  
272    
273    echo "|================================|=============|=======|"                                                 >> ${all_ccfs_table}
274    echo                                                                                                            >> ${all_ccfs_table}
275    echo "(*): Incomplete range."                                                                                   >> ${all_ccfs_table}
276    echo ""                                                                                                         >> ${all_ccfs_table}
277    echo "Total number of valid CCFs required : ${total_number_of_ccfs}"                                            >> ${all_ccfs_table}
278    rm ${VALID_CCF}/ccf_classes.txt
279    rm ${VALID_CCF}/ccf_issues_for*.txt

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.8

  ViewVC Help
Powered by ViewVC 1.1.27