aboutsummaryrefslogtreecommitdiff
path: root/noao/digiphot/apphot/aplib/apairmass.x
blob: 3dcb9cdf3fc714b66b68a8c81c9d7e4cd45f13d2 (plain) (blame)
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
include <imhdr.h>
include "../lib/apphot.h"

# AP_AIRMASS -  Procedure to determine the image airmass.

procedure ap_airmass (im, ap)

pointer	im		# pointer to IRAF image
pointer	ap		# pointer to apphot structure

pointer	sp, key
real	xair
real	imgetr(), apstatr()

begin
	call smark (sp)
	call salloc (key, SZ_FNAME, TY_CHAR)
	call apstats (ap, AIRMASS, Memc[key], SZ_FNAME)
	if (Memc[key] == EOS)
	    xair = apstatr (ap, XAIRMASS)
	else {
	    iferr { 
	        xair = imgetr (im, Memc[key])
	    } then {
		xair = apstatr (ap, XAIRMASS)
		call eprintf ("Warning: Image %s  Keyword: %s not found\n")
		    call pargstr (IM_HDRFILE(im))
		    call pargstr (Memc[key])
	    }
	}
	if (IS_INDEFR(xair) || xair <= 0.0)
	    call apsetr (ap, XAIRMASS, INDEFR)
	else
	    call apsetr (ap, XAIRMASS, xair)
	call sfree (sp)
end