diff options
author | Joe Hunkeler <jhunkeler@gmail.com> | 2015-08-11 16:51:37 -0400 |
---|---|---|
committer | Joe Hunkeler <jhunkeler@gmail.com> | 2015-08-11 16:51:37 -0400 |
commit | 40e5a5811c6ffce9b0974e93cdd927cbcf60c157 (patch) | |
tree | 4464880c571602d54f6ae114729bf62a89518057 /noao/imred/vtel/decodeheader.x | |
download | iraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz |
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'noao/imred/vtel/decodeheader.x')
-rw-r--r-- | noao/imred/vtel/decodeheader.x | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/noao/imred/vtel/decodeheader.x b/noao/imred/vtel/decodeheader.x new file mode 100644 index 00000000..5d54753d --- /dev/null +++ b/noao/imred/vtel/decodeheader.x @@ -0,0 +1,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 |