1
! @(#)compFITS.prg 19.1 (ESO-DMD) 02/25/03 13:20:07
2
! ++++++++++++++++++++++++++++++++++++++++++++++++++++++
4
! Midas application procedure compFITS.prg
5
! K. Banse ESO - Garching 000726, 020229
7
! to compare primary headers of FITS files
9
! execute as: @a compFITS flag file1 file2
11
! flag = IMAGE, TABLE, FITS or DIFFERENCES,dflag
14
! dflag = xy, x = 0/1 ignore/not ignore empty lines
15
! y = 0/1 if no/yes special descriptors in file2
17
! file1 = name of ASCII file holding already the differences of the
18
! FITS headers of two FITS images/tables
21
! file2 = list of descr.s which may differ and are ignored
24
! file1, file2 = image, table, FITS file names (if flag = I, T, F)
28
! -1, if file open errror
30
! e.g. @a compFITS F lola.mt cuca.mt
32
! ++++++++++++++++++++++++++++++++++++++++++++++++++++++
34
define/param p1 image c "Enter flag (IMAGE/TABLE):"
35
define/local diffy/c/1/2 00
36
set/format i2 !needed later on for M$PARSE()
38
if p1(1:1) .eq. "D" then
39
define/param p2 middif.dat c "Enter ASCII file name with differences:"
40
define/local diffname/c/1/80 {p2}
41
inputi = m$index(p1,",") + 1
43
inputi(2) = inputi + 1
44
diffy(1:2) = p1({inputi(1)}:{inputi(2)})
48
define/local diffname/c/1/80 middif.dat
49
$\rm -f middat1.dat middat2.dat
50
if p1(1:1) .eq. "F" then
51
define/param p2 ? C "Enter first FITS file:"
52
define/param p3 ? C "Enter second FITS file:"
53
intape/fits 1 midd {p2} fnn >middat1.dat
54
intape/fits 1 midd {p3} fnn >middat2.dat
57
if p1(1:1) .eq. "I" then
58
define/param p2 ? image "Enter first Midas image:"
59
define/param p3 ? image "Enter second Midas image:"
60
else if p1(1:1) .eq. "T" then
61
define/param p2 ? table "Enter first Midas table:"
62
define/param p3 ? table "Enter second Midas table:"
64
write/out invalid input flag...
68
write/out converting {p2} and {p3} to FITS format ...
69
outdisk/fits {p2} middf1.fits >Null
70
intape/fits 1 midd middf1.fits fnn >middat1.dat
71
outdisk/fits {p3} middf2.fits >Null
72
intape/fits 1 midd middf2.fits fnn >middat2.dat
75
write/out comparing the primary header of these FITS files ...
76
if aux_mode .lt. 2 then
77
write/out Sorry, this procedure has not been updated for VMS yet ...
80
$diff middat1.dat middat2.dat > {diffname}
84
define/local fc/i/1/2 0,0
85
open/file {diffname} read fc
87
write/out Problems in opening ASCII file "{diffname}"
91
if diffy(2:2) .eq. "1" then
92
define/local dcount/i/1/1 0
93
dcount = m$parse(p3,"lola")
96
define/local compar{inputi}/c/1/9 " " all
97
write/keyw compar{inputi}/c/1/8 {lola{inputi}}
98
compar{inputi}(9:9) = "="
106
write/key inputc/c/1/20 " " all
107
read/file {fc(1)} inputc 20
110
write/out FITS headers are `equal'...
114
! only DATE and FILENAME should be different, nothing else...
116
if inputc(1:1) .ne. "<" .and. inputc(1:1) .ne. ">" then
120
if inputc(3:7) .eq. "DATE " goto read_loop
121
if inputc(3:11) .eq. "FILENAME=" goto read_loop
122
if inputc(3:10) .eq. "HISTORY " goto read_loop
124
if diffy(1:1) .eq. "0" then !ignore blank lines
125
if inputc(3:3) .eq. " " goto read_loop
127
if diffy(2:2) .eq. "1" then !ignore blank lines
129
if inputc(3:10) .eq. compar{inputi}(1:8) goto read_loop
133
! some other differences found...
134
write/out line: \"{inputc(1:20)}\" " " is bad...