2 |
|
|
3 |
# mlovccf (make list of valid ccfs) |
# mlovccf (make list of valid ccfs) |
4 |
# |
# |
5 |
# Makes the list of valid CCF. This is the list of the CCFs required to process any ODF |
# Makes the list of valid CCFs that are all CCFs, among those published since the |
6 |
# at the current 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 |
8 |
|
# CCFs are issued to deal with new calibration data and/or replace obsolete ones. |
9 |
# |
# |
10 |
# To get 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 task of cifbuild. |
11 |
# To get such list, cifbuild needs only the ODF observation time, typically the start |
# To make such identification, cifbuild needs only the start time of the observation. |
|
# of it. If we do this exercise for all observed ODFs at a given date, we will obtain |
|
|
# for such a moment, the list of valid CCFs required to process any observed ODF. |
|
12 |
# |
# |
13 |
# $Id$ |
# If we get the list of required CCFs for all observed ODFs at a given date, |
14 |
|
# we will obtain for such a moment, the list of valid CCFs required to process |
15 |
|
# any observed ODF. Thus, we need as input the list of all observed ODFs at a given |
16 |
|
# 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). |
18 |
|
# |
19 |
|
# $Id: mlovccf,v 1.1 2015/03/09 17:06:20 ccflib Exp $ |
20 |
|
|
21 |
host=`hostname | cut -d. -f1` |
host=`hostname | cut -d. -f1` |
22 |
|
|
41 |
|
|
42 |
} |
} |
43 |
|
|
44 |
# Function get_ccf_list to list on stdout the table of CCFS in a given CIF |
# Function get_ccf_list to list on stdout the table of CCFs in a given CIF |
45 |
# |
# |
46 |
# requires Heasoft be initialized. Otherwise exits with error. |
# Requires that Heasoft is initialised. Otherwise exits with error. |
47 |
|
|
48 |
get_ccf_list() |
get_ccf_list() |
49 |
{ |
{ |
64 |
} |
} |
65 |
|
|
66 |
|
|
67 |
# We need to get the list of all observed ODFs at the current date. This is obtained from |
# We need to get the list of all observed ODFs at the current date. |
68 |
# ftp://nxsa.esac.esa.int/pub/cds_obslog/xsaobslog.txt. |
# This is obtained from ftp://nxsa.esac.esa.int/pub/cds_obslog/xsaobslog.txt. |
69 |
|
|
70 |
VALID_CCF="$HOME/valid_ccf" |
VALID_CCF="$HOME/valid_ccf" |
71 |
|
|
100 |
# Now scans the list of OBDS ID registered in the previous list to get the start time |
# Now scans the list of OBDS ID registered in the previous list to get the start time |
101 |
# and then runs cifbuild to get the respective CIF |
# and then runs cifbuild to get the respective CIF |
102 |
|
|
103 |
|
# Output file |
104 |
touch ${VALID_CCF}/all_ccfs.txt |
touch ${VALID_CCF}/all_ccfs.txt |
105 |
|
|
106 |
n=0 |
n=0 |
107 |
|
|
108 |
while read line |
while read line |
109 |
do |
do |
110 |
obsid=`echo $line | awk -F"|" '{print $2}'` |
obsid=`echo $line | awk -F"|" '{print $2}'` |
136 |
issue=`echo $line | awk -F" " '{print $3}'` |
issue=`echo $line | awk -F" " '{print $3}'` |
137 |
issue=`printf "%04d" ${issue}` |
issue=`printf "%04d" ${issue}` |
138 |
echo ${class}_${issue}.CCF >> ${VALID_CCF}/${obsid}_ccfs.txt |
echo ${class}_${issue}.CCF >> ${VALID_CCF}/${obsid}_ccfs.txt |
139 |
|
|
140 |
done < ${VALID_CCF}/${obsid}_ccfs.tmp |
done < ${VALID_CCF}/${obsid}_ccfs.tmp |
141 |
|
|
142 |
rm ${VALID_CCF}/${obsid}_ccfs.tmp |
rm ${VALID_CCF}/${obsid}_ccfs.tmp |
143 |
|
|
144 |
mv ${VALID_CCF}/all_ccfs.txt ${VALID_CCF}/all_ccfs.tmp |
mv ${VALID_CCF}/all_ccfs.txt ${VALID_CCF}/all_ccfs.tmp |
145 |
cat ${VALID_CCF}/${obsid}_ccfs.txt ${VALID_CCF}/all_ccfs.tmp \ |
|
146 |
| sort -u > ${VALID_CCF}/all_ccfs.txt |
cat ${VALID_CCF}/${obsid}_ccfs.txt ${VALID_CCF}/all_ccfs.tmp | sort -u > ${VALID_CCF}/all_ccfs.txt |
147 |
|
|
148 |
rm ${cif_file} |
rm ${cif_file} |
149 |
rm ${VALID_CCF}/${obsid}_ccfs.txt |
rm ${VALID_CCF}/${obsid}_ccfs.txt |
150 |
|
rm ${VALID_CCF}/all_ccfs.tmp |
151 |
|
|
152 |
done < ${VALID_CCF}/xsaobslog.txt |
done < ${VALID_CCF}/xsaobslog.txt |
153 |
|
|
154 |
|
# Make a table of classes and issues type "Pipeline Release Notes" |
155 |
|
|
156 |
|
# Lists all CCF classes |
157 |
|
|
158 |
|
ccf_classes="${VALID_CCF}/ccf_classes.txt" |
159 |
|
|
160 |
|
while read line |
161 |
|
do |
162 |
|
class=`echo $line | awk -F"_" '{print $1"_"$2}'` |
163 |
|
echo $class >> ${ccf_classes} |
164 |
|
done < ${VALID_CCF}/all_ccfs.txt |
165 |
|
|
166 |
|
cat ${ccf_classes} | sort -u > ${VALID_CCF}/kk.txt |
167 |
|
mv ${VALID_CCF}/kk.txt ${ccf_classes} |
168 |
|
|
169 |
|
# Output final file is named all_ccfs_table.txt |
170 |
|
|
171 |
|
all_ccfs_table="{VALID_CCF}/all_ccfs_table.txt |
172 |
|
|
173 |
|
[ -f "${all_ccfs_table}" ] && rm ${all_ccfs_table} |
174 |
|
|
175 |
|
echo "|================================|=============|" >> ${all_ccfs_table} |
176 |
|
echo "| Calibration File | Issue range |" >> ${all_ccfs_table} |
177 |
|
echo "|================================|=============|" >> ${all_ccfs_table} |
178 |
|
|
179 |
|
while read ccf_class |
180 |
|
do |
181 |
|
issues_file="${VALID_CCF}/ccf_issues_for_${ccf_class}.txt" |
182 |
|
[ -f "${issues_file}" ] && rm ${issues_file} |
183 |
|
while read line |
184 |
|
do |
185 |
|
class=`echo $line | awk -F"_" '{print $1"_"$2}'` |
186 |
|
[ "$class" != "$ccf_class" ] && continue |
187 |
|
issue=`echo $line | awk -F"_" '{print $3}' | cut -d. -f1` |
188 |
|
echo $issue >> ${issues_file} |
189 |
|
done < ${VALID_CCF}/all_ccfs.txt |
190 |
|
|
191 |
|
cat ${issues_file} | sort -u > kk.txt |
192 |
|
mv kk.txt ${issues_file} |
193 |
|
|
194 |
|
first_issue=`head -1 ${issues_file}` |
195 |
|
last_issue=`tail -1 ${issues_file}` |
196 |
|
|
197 |
|
if [ "${first_issue}" != "${last_issue}" ] ; then |
198 |
|
printf "| %-30s | %4s-%4s |\n" ${ccf_class} ${first_issue} ${last_issue} >> ${all_ccfs_table} |
199 |
|
else |
200 |
|
printf "| %-30s | %4s |\n" ${ccf_class} ${first_issue} >> ${all_ccfs_table} |
201 |
|
fi |
202 |
|
|
203 |
|
done < ${ccf_classes} |
204 |
|
|
205 |
|
echo "|================================|=============|" >> ${all_ccfs_table} |