source: trunk/DataCheck/Archive/checkForHeaderUpdatesRaw.sh@ 15765

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