/[CCFs]/bin/mlovccf
ViewVC logotype

Diff of /bin/mlovccf

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

revision 1.2 by ccflib, Tue Mar 10 13:27:33 2015 UTC revision 1.3 by ccflib, Tue Mar 10 16:51:28 2015 UTC
# Line 16  Line 16 
16  # date. This is obtained from the report of all observations that the XSA makes to CDS,  # date. This is obtained from the report of all observations that the XSA makes to CDS,
17  # xsaobslog.txt (ftp://nxsa.esac.esa.int/pub/cfs_obslog/xsaobslog.txt).  # xsaobslog.txt (ftp://nxsa.esac.esa.int/pub/cfs_obslog/xsaobslog.txt).
18  #  #
19  # $Id: mlovccf,v 1.1 2015/03/09 17:06:20 ccflib Exp $  # $Id: mlovccf,v 1.2 2015/03/10 13:27:33 ccflib Exp $
20    
21  host=`hostname | cut -d. -f1`  host=`hostname | cut -d. -f1`
22    
23    now=`date +'%Y-%M-%dT%H:%M:%S'`
24    
25  # 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
26    
27  find_latest_mif()  find_latest_mif()
# Line 101  find_latest_mif "${SAS_CCFPATH}" Line 103  find_latest_mif "${SAS_CCFPATH}"
103  # and then runs cifbuild to get the respective CIF  # and then runs cifbuild to get the respective CIF
104    
105  # Output file  # Output file
106  touch ${VALID_CCF}/all_ccfs.txt  touch ${VALID_CCF}/all_ccfs_${now}.txt
107    
108  n=0  n=0
109    
# Line 141  do Line 143  do
143    
144          rm ${VALID_CCF}/${obsid}_ccfs.tmp          rm ${VALID_CCF}/${obsid}_ccfs.tmp
145    
146          mv ${VALID_CCF}/all_ccfs.txt ${VALID_CCF}/all_ccfs.tmp          mv ${VALID_CCF}/all_ccfs_${now}.txt ${VALID_CCF}/all_ccfs_${now}.tmp
147    
148          cat ${VALID_CCF}/${obsid}_ccfs.txt ${VALID_CCF}/all_ccfs.tmp | sort -u  >  ${VALID_CCF}/all_ccfs.txt          cat ${VALID_CCF}/${obsid}_ccfs.txt ${VALID_CCF}/all_ccfs_${now}.tmp | sort -u  >  ${VALID_CCF}/all_ccfs_${now}.txt
149    
150          rm ${cif_file}          rm ${cif_file}
151          rm ${VALID_CCF}/${obsid}_ccfs.txt          rm ${VALID_CCF}/${obsid}_ccfs.txt
152          rm ${VALID_CCF}/all_ccfs.tmp          rm ${VALID_CCF}/all_ccfs_${now}.tmp
153    
154  done < ${VALID_CCF}/xsaobslog.txt  done < ${VALID_CCF}/xsaobslog.txt
155    
# Line 161  while read line Line 163  while read line
163  do  do
164          class=`echo $line | awk -F"_" '{print $1"_"$2}'`          class=`echo $line | awk -F"_" '{print $1"_"$2}'`
165          echo $class >> ${ccf_classes}          echo $class >> ${ccf_classes}
166  done < ${VALID_CCF}/all_ccfs.txt  done < ${VALID_CCF}/all_ccfs_${now}.txt
167    
168  cat ${ccf_classes} | sort -u > ${VALID_CCF}/kk.txt  cat ${ccf_classes} | sort -u > ${VALID_CCF}/kk.txt
169  mv ${VALID_CCF}/kk.txt ${ccf_classes}  mv ${VALID_CCF}/kk.txt ${ccf_classes}
170    
171  # Output final file is named all_ccfs_table.txt  # Output final file is named all_ccfs_${now}_table.txt
172    
173    total_number_of_ccfs=0
174    
175  all_ccfs_table="{VALID_CCF}/all_ccfs_table.txt  all_ccfs_table="{VALID_CCF}/all_ccfs_${now}_table.txt
176    
177  [ -f "${all_ccfs_table}" ] && rm ${all_ccfs_table}  [ -f "${all_ccfs_table}" ] && rm ${all_ccfs_table}
178    
179    echo "Table of valid CCFs at $now"                      >> ${all_ccfs_table}
180    echo                                                    >> ${all_ccfs_table}
181  echo "|================================|=============|" >> ${all_ccfs_table}  echo "|================================|=============|" >> ${all_ccfs_table}
182  echo "| Calibration File               | Issue range |" >> ${all_ccfs_table}  echo "| Calibration File               | Issue range |" >> ${all_ccfs_table}
183  echo "|================================|=============|" >> ${all_ccfs_table}  echo "|================================|=============|" >> ${all_ccfs_table}
184    
185  while read ccf_class  while read ccf_class
186  do  do
187            echo -n "Processing class $ccf_class ..."
188          issues_file="${VALID_CCF}/ccf_issues_for_${ccf_class}.txt"          issues_file="${VALID_CCF}/ccf_issues_for_${ccf_class}.txt"
189          [ -f "${issues_file}" ] && rm ${issues_file}          [ -f "${issues_file}" ] && rm ${issues_file}
190          while read line          while read line
# Line 186  do Line 193  do
193                  [ "$class" != "$ccf_class" ] && continue                  [ "$class" != "$ccf_class" ] && continue
194                  issue=`echo $line | awk -F"_" '{print $3}' | cut -d. -f1`                  issue=`echo $line | awk -F"_" '{print $3}' | cut -d. -f1`
195                  echo $issue >> ${issues_file}                  echo $issue >> ${issues_file}
196          done < ${VALID_CCF}/all_ccfs.txt          done < ${VALID_CCF}/all_ccfs_${now}.txt
197    
198          cat ${issues_file} | sort -u > kk.txt          cat ${issues_file} | sort -u > kk.txt
199          mv kk.txt ${issues_file}          mv kk.txt ${issues_file}
200            real_number_of_issues_for_this_class=`wc -l ${issues_file} | awk -F" " '{print $1}'`
201    
202          first_issue=`head -1 ${issues_file}`          first_issue=`head -1 ${issues_file}`
203          last_issue=`tail -1 ${issues_file}`          last_issue=`tail -1 ${issues_file}`
204    
205            li=$((10#$last_issue))
206            fi=$((10#$first_issue))
207    
208            sequential_number_of_issues_for_this_class=$(($li - $fi + 1))
209            if [ "${real_number_of_issues_for_this_class}"  -lt "${sequential_number_of_issues_for_this_class}" ] ; then
210                    asterisk="(*)"
211            else
212                    asterisk="   "
213            fi
214            total_number_of_ccfs=$(($real_number_of_issues_for_this_class + $total_number_of_ccfs))
215    
216          if [ "${first_issue}" != "${last_issue}" ] ; then          if [ "${first_issue}" != "${last_issue}" ] ; then
217                  printf "| %-30s | %4s-%4s   |\n" ${ccf_class} ${first_issue} ${last_issue} >> ${all_ccfs_table}                  printf "| %-30s | %4s-%4s%3s|\n" ${ccf_class} ${first_issue} ${last_issue} ${asterisk} >> ${all_ccfs_table}
218          else          else
219                  printf "| %-30s | %4s        |\n" ${ccf_class} ${first_issue}              >> ${all_ccfs_table}                  printf "| %-30s | %4s        |\n" ${ccf_class} ${first_issue}                          >> ${all_ccfs_table}
220          fi          fi
221        
222  done < ${ccf_classes}    done < ${ccf_classes}  
223    
224  echo "|================================|=============|"                                    >> ${all_ccfs_table}  echo "|================================|=============|"                                                >> ${all_ccfs_table}
225    echo                                                                                                   >> ${all_ccfs_table}
226    echo "(*): Some issues in the range are not required."                                                 >> ${all_ccfs_table}
227    rm ${VALID_CCF}/ccf_classes.txt
228    rm ${VALID_CCF}/ccf_issues_for*.txt
229    
230    
231    
232    echo ; echo "Number of valid CCFs required as of $now : ${total_number_of_ccfs}"

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

  ViewVC Help
Powered by ViewVC 1.1.27