source: trunk/DataCheck/Archive/checkForHeaderUpdatesAux.sh@ 18481

Last change on this file since 18481 was 12871, checked in by lyard, 13 years ago
added more scripts
  • Property svn:executable set to *
File size: 4.0 KB
Line 
1#!/bin/bash
2
3month=$1
4
5if [ "$month" == "" ]
6then
7 echo "Please give the month to look for as parameter"
8 exit
9fi
10
11archive="/archive/fact/rev_1/aux/2011/"$month
12tempFile="tempFile$month.txt"
13tempFile2="tempFile2$month.txt"
14entries=`find $archive -type f -name '*.fits' | sort`
15
16for entry in ${entries[@]}
17do
18 if [ -f $tempFile ]
19 then
20 rm $tempFile
21 fi
22 if [ -f $tempFile2 ]
23 then
24 rm $tempFile2
25 fi
26
27 tstartf=1
28 tstartf2=2
29
30 result=`/opt/FACT++/fitsdump -h $entry > $tempFile`
31 origEntry=`echo $entry | sed -e 's/archive\/fact\/rev_1/data00\/fact-construction/g'`
32 if [ ! -f $origEntry ]
33 then
34 echo $entry >> headerReportAux_$month.txt
35 echo "Name was changed" >> headerReportAux_$month.txt
36 continue
37 fi
38 result2=`/opt/FACT++/fitsdump -h $origEntry > $tempFile2`
39
40 tstartf=`grep 'TSTARTF' $tempFile | grep -E -o '0\.[0-9]{7}' `
41 tstartf2=`grep 'TSTARTF' $tempFile2 | grep -E -o '0\.[0-9]{7}' `
42 if [ "$tstartf" == "" ]
43 then
44 tstartf=`grep 'TSTARTF' $tempFile | grep -E -o '0'`
45 fi
46 if [ "$tstartf2" == "" ]
47 then
48 tstartf2=`grep 'TSTARTF' $tempFile2 | grep -E -o '0'`
49 fi
50
51 tstarti=`grep 'TSTARTI' $tempFile | grep -E -o '[0-9]{5}' `
52 tstarti2=`grep 'TSTARTI' $tempFile2 | grep -E -o '[0-9]{5}' `
53 tstopf=`grep 'TSTOPF' $tempFile | grep -E -o '0\.[0-9]{7}'`
54 tstopf2=`grep 'TSTOPF' $tempFile2 | grep -E -o '0\.[0-9]{7}'`
55 if [ "$tstopf" == "" ]
56 then
57 tstopf=`grep 'TSTOPF' $tempFile | grep -E -o '0'`
58 fi
59 if [ "$tstopf2" == "" ]
60 then
61 tstopf2=`grep 'TSTOPF' $tempFile2 | grep -E -o '0'`
62 fi
63 tstopi=`grep 'TSTOPI' $tempFile | grep -E -o '[0-9]{5}'`
64 tstopi2=`grep 'TSTOPI' $tempFile2 | grep -E -o '[0-9]{5}'`
65 dateobs=`grep 'DATE-OBS' $tempFile | grep -E -o 201[1-3]-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{4}`
66 dateobs2=`grep 'DATE-OBS' $tempFile2 | grep -E -o 201[1-3]-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{4}`
67 dateend=`grep 'DATE-END' $tempFile | grep -E -o 201[1-3]-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{4} `
68 dateend2=`grep 'DATE-END' $tempFile2 | grep -E -o 201[1-3]-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{4}`
69 telescop=`grep 'TELESCOP' $tempFile`
70 telescop2=`grep 'TELESCOP' $tempFile2`
71 package=`grep 'PACKAGE' $tempFile`
72 package2=`grep 'PACKAGE' $tempFile2`
73 origin=`grep 'ORIGIN' $tempFile`
74 origin2=`grep 'ORIGIN' $tempFile2`
75 timeunit=`grep 'TIMEUNIT' $tempFile`
76 timeunit2=`grep 'TIMEUNIT' $tempFile2`
77 mjdref=`grep -E '## +MJDREF' $tempFile`
78 mjdref2=`grep -E '## +MJDREF' $tempFile2`
79 timesys=`grep 'TIMESYS' $tempFile`
80 timesys2=`grep 'TIMESYS' $tempFile2`
81
82 echo $entry >> headerReportAux_$month.txt
83 echo $entry
84
85 if [ "$tstarti" != "$tstarti2" ]
86 then
87 echo "TSTARTI. new: "$tstarti" old: "$tstarti2 >> headerReportAux_$month.txt
88 fi
89 if [ "$tstartf" != "$tstartf2" ]
90 then
91 echo "TSTARTF. new: "$tstartf" old: "$tstartf2 >> headerReportAux_$month.txt
92 fi
93 if [ "$tstopi" != "$tstopi2" ]
94 then
95 echo "TSTOPI. new: "$tstopi" old: "$tstopi2 >> headerReportAux_$month.txt
96 fi
97 if [ "$tstopf" != "$tstopf2" ]
98 then
99 echo "TSTOPF. new: "$tstopf" old: "$tstopf2 >> headerReportAux_$month.txt
100 fi
101 if [ "$dateobs" != "$dateobs2" ]
102 then
103 echo "DATEOBS. new: "$dateobs" old: "$dateobs2 >> headerReportAux_$month.txt
104 fi
105 if [ "$dateend" != "$dateend2" ]
106 then
107 echo "DATEEND. new: "$dateend" old: "$dateend2 >> headerReportAux_$month.txt
108 fi
109 if [ "$telescop" != "$telescop2" ]
110 then
111 echo "TELESCOP. new: "$telescop" old: "$telescop2 >> headerReportAux_$month.txt
112 fi
113 if [ "$package" != "$package2" ]
114 then
115 echo "PACKAGE. new: "$package" old: "$package2 >> headerReportAux_$month.txt
116 fi
117 if [ "$origin" != "$origin2" ]
118 then
119 echo "ORIGIN. new: "$origin" old: "$origin2 >> headerReportAux_$month.txt
120 fi
121 if [ "$timeunit" != "$timeunit2" ]
122 then
123 echo "TIMEUNIT. new: "$timeunit" old: "$timeunit2 >> headerReportAux_$month.txt
124 fi
125 if [ "$mjdref" != "$mjdref2" ]
126 then
127 echo "MJDREF. new: "$mjdref" old: "$mjdref2 >> headerReportAux_$month.txt
128 fi
129 if [ "$timesys" != "$timesys2" ]
130 then
131 echo "TIMESYS. new: "$timesys" old: "$timesys2 >> headerReportAux_$month.txt
132 fi
133done
134
Note: See TracBrowser for help on using the repository browser.