1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
include <mach.h>
include "vt.h"
# DECODEHEADER -- Unpack date and time, and, if 'verbose' flag is set,
# display some information to the user.
procedure decodeheader (hbuf, hs, verbose)
pointer hbuf # header data input buffer pointer (short, SZ_VTHDR)
pointer hs # header data structure
bool verbose # verbose flag
int hour, minute, second
int bitupk()
begin
# Unpack date, time. The constants below are explained in the
# description of the image header and how it is packed. If any
# changes are made the following code will have to be rewritten.
# Month. The month and day are stored in the first header word.
VT_HMONTH[hs] = (bitupk (int(Mems[hbuf]), 13, 4)) * 10 +
bitupk (int(Mems[hbuf]), 9, 4)
# Day.
VT_HDAY[hs] = (bitupk (int(Mems[hbuf]), 5, 4)) * 10 +
bitupk (int(Mems[hbuf]), 1, 4)
# Year. The year is stored in the second header word.
VT_HYEAR[hs] = (bitupk (int(Mems[hbuf+1]), 13, 4)) * 10 +
bitupk (int(Mems[hbuf+1]), 9, 4)
# Time (seconds since midnight). Stored in the third and forth words.
VT_HTIME[hs] = (bitupk (int(Mems[hbuf+2]), 1, 2)) * 2**15 +
bitupk (int(Mems[hbuf+3]), 1, 15)
# Store other header parameters. Stored one per word.
VT_HWVLNGTH[hs] = Mems[hbuf+4] # Wavelength (angstroms)
VT_HOBSTYPE[hs] = Mems[hbuf+5] # Observation type (0,1,2,3,or 4)
VT_HAVINTENS[hs] = Mems[hbuf+6] # Average intensity
VT_HNUMCOLS[hs] = Mems[hbuf+7] # Number of columns
VT_HINTGPIX[hs] = Mems[hbuf+8] # Integrations per pixel
VT_HREPTIME[hs] = Mems[hbuf+9] # Repitition time
# Calculate the time in hours, minutes, and seconds instead of
# seconds since midnight.
hour = int(VT_HTIME[hs]/3600)
minute = int((VT_HTIME[hs] - hour * 3600)/60)
second = VT_HTIME[hs] - hour * 3600 - minute * 60
# If verbose, print out some header info on one line no <CR>.
if (verbose) {
call printf ("%02d/%02d/%02d %02d:%02d:%02d")
call pargi (VT_HMONTH[hs])
call pargi (VT_HDAY[hs])
call pargi (VT_HYEAR[hs])
call pargi (hour)
call pargi (minute)
call pargi (second)
call printf (" wvlngth %d obstype %d numcols %d")
call pargi (VT_HWVLNGTH[hs])
call pargi (VT_HOBSTYPE[hs])
call pargi (VT_HNUMCOLS[hs])
call flush (STDOUT)
}
end
|