1
! @(#)airmass.prg 19.1 (ESO-DMD) 02/25/03 13:20:04
2
!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6
!.AUTHOR M. Rosa (ST_ECF) VERSION 2.0 29-MAR-1986
7
! D. Baade (ST-ECF) 870207
8
! KB 901108, 920226, 920319, 941128
12
! airmass calculation, Julian date, conversion between UT and ST
14
!.PURPOSE Calculate airmass ( = f(sec z) ) and JD and sidereal time
15
! Use and update descriptors in frame option.
16
! Order of positional parameters longitude and latitude exchanged
17
! convert to eastern longitude! PJG
18
! Input has been changed so that eastern longitude is required
19
! following IAU standards. PJG
21
!.CALL a) AIRMASS image [long] [lat]
22
! b) AIRMASS ra dec [ST] [dur] [long] [lat] date UT
24
! a) input from and to image descriptors
26
! The descriptor O_TIME is organized as follows:
28
! 1) YEAR 2) MONTH 3) DAY 4) JD 5) UT (hrs...)
29
! 6) ST (hrs...) 7) DUR (seconds) 8) Offset of UT clock (hrs...)
31
! ST and JD will always be (re-)calculated by the program.
32
! (Use command WRITE/DESC if UT, date, and/or duration are not set)
34
! O_POS(1): right ascension in real degrees (!!, not: hours)
35
! O_POS(2): declination in real degrees
37
! b) input only from keywords
39
! ra right ascension in HH,MM,SS
40
! dec declination in DD,MM,SS
41
! ST sidereal time in HH,MM,SS (DEFAULT: = RA)
43
! if ST > 25 ---> ST = ra
44
! if ST < 0, ST will be calculated from UT and date
45
! dur exposure time (default: 0.0)
46
! long east longitude in DD,MM,SS.ss (DEFAULT: ESO -70,43,55.35)
47
! lat latitude in DD,MM,SS.ss (DEFAULT: ESO -29,15,25.8)
49
! UT UT in HH,MM,SS.ss..
51
! If DUR > 0.0, some mean airmass for exposure time is calculated
52
! (arithmetic mean of AIRM(ST), AIRM(ST+0.5DUR), AIRM(ST+DUR))
54
!------------------------------------------------------------------------------
56
!.INPUT (interactive mode)
57
! Right ascension (HH,MM,SS.ss...) INPUTR(1:3)
58
! Declination (DD,MM,SS.ss...) INPUTR(4:6)
59
! Sidereal time (HH,MM,SS.ss...) INPUTR(7:9)
60
! exposure time (sec) INPUTR(10:10)
61
! East longitude (DD,MM,SS.ss...) INPUTR(11:13)
62
! Latitude (DD,MM,SS.ss...) INPUTR(14:16)
63
! UT (HH,MM,SS.ss...) INPUTR(17:19)
64
! year,month,day INPUTI(1:3)
66
! If exposure time > 0.0 sec the airmass calculated is the
67
! average of airmasses at t0, 0.5(t1+t0) and t1
69
! UT+longitude+year,month,day and ST are equivalent.
70
! Therefore: non-positive SID resp. non-positive UT request the
71
! UT resp. SID to be used in calc. of airmass
75
!---------------------------------------------------------------
77
define/local signs/c/1/2 ++ ! signs of latitude and declination
78
define/local rneg/r/1/1 1.0
80
set/format g10.5,g24.12
82
define/param p1 ? ? "Enter image or right ascension (hour,min,sec): "
84
if m$index(p1,",") .ne. 0 goto keys !check, if frame or number(s)
85
if m$tstno(p1) .ne. 0 goto keys
87
! ... a) input and output from and to descriptors of image
91
define/local image/c/1/100 {p1} !name of image
92
define/local long/c/1/40 0 !eastern longitude
93
define/local lat/c/1/40 0 !latitude
95
define/param p2 0 N ! eastern longitude of observatory (no input=0)
96
define/param p3 0 N ! latitude of observatory (no input=0)
98
! check first if input for longitude/latitude on line:
100
if p2 .eq. "0" .and. p3 .eq. "0" then
101
! no input on command line found.
102
! check if descriptors there
103
if m$existd(p1,"ESO.TEL.GEOLON") .eq. 1 .AND. m$existd(p1,"ESO.TEL.GEOLAT") .eq. 1 then
104
write/out ** Descriptors for longitude and latitude of telescope found **
105
write/out ** ESO.TEL.GEOLON and ESO.TEL.GEOLAT will be used **
107
write/key long/c/1/40 {{p1},ESO.TEL.GEOLON},0,0
108
write/key lat/c/1/40 {{p1},ESO.TEL.GEOLAT},0,0
110
write/out ** No descriptors ESO.TEL.GEOLON, ESO.TEL.GEOLAT found **
111
! if no long and lat AND no descriptors there, use default: La Silla
112
p2 = "-70.,43.,55.35"
114
write/out ** Default (=longitude and latitude of La Silla) will be used **
115
write/key long/c/1/40 {p2},0,0 !eastern longitude
116
write/key lat/c/1/40 {p3},0,0 !latitude
119
! yes, input on command line:
120
write/out ** Longitude: {p2} and latitude: {p3} used **
121
write/key long/c/1/40 {p2},0,0 !eastern longitude
122
write/key lat/c/1/40 {p3},0,0 !latitude
125
! ... first compute ST and JD
126
! ... (results in keywords OUTPUTD(19) and OUTPUTD(20) as well as
127
! ... image descriptors O_TIME(6) and O_TIME(4) respectively
129
compute/st {image} {long}
131
inputr(1) = outputd(19)*15.-m$value({image},o_pos(1)) !H.A. = ST-R.A. (hour_ang)
132
write/keyw inputr/r/2/3 {{image},o_pos(2)},0,0 !declination
133
if inputr(2) .lt. 0.0 signs(2:2) = "-" !negative declination
134
inputr(5) = m$value({image},o_time(7)) !length of exposure
135
write/keyw inputr/r/6/3 {lat} !latitude of observatory
136
signs(1:1) = lat(1:1)
137
rneg = (inputr(6)*3600.)+(inputr(7)*60.)+inputr(8)
138
if rneg .lt. 0.0 signs(1:1) = "-"
140
run MID_EXE:AIRMASS ! compute mean airmass
142
copy/kd outputr/r/1/1 {p1} o_airm/r/1/1 ! write result to descriptor
144
write/out "Image: {IMAGE} Mean airmass: {OUTPUTR(1)}"
150
! Interactive option:
152
define/param p2 ? ? "Enter declination (degree,min,sec): "
153
define/param p3 -1.0. N ! ST
154
define/param p4 0.0 N ! exposure time
155
define/param p5 -70.,43.,55.35 N ! east longitude (def. La Silla)
156
define/param p6 -29.,15.,25.8 N ! latitude (def.: La Silla)
158
define/local alpha0/r/1/3 {p1},0,0 ! right ascension as hour,min,sec
159
define/local alpha/r/1/1 0 ! right ascension in hours
160
define/local delta/c/1/40 "{p2},0,0" ! declination
161
define/local st/r/1/1 {p3} ! ST
162
define/local exptim/r/1/1 {p4} ! exposure time (in seconds)
163
define/local long/c/1/40 "{p5},0,0" ! longitude
164
define/local lat/c/1/40 "{p6},0,0" ! latitude
166
! ... if ST not known (i.e. entered as negative) but wanted calculate it first
169
define/param p7 ? N "Enter date of observation (year,month,day): "
170
define/param p8 ? N "Enter UT of observation (hour,min,sec): "
172
define/local date/c/1/40 "{p7},0,0" ! date
173
define/local ut/c/1/40 "{p8},0,0" ! UT
175
compute/st {date} {ut} {long}
179
alpha = alpha0(1)+(alpha0(2)+alpha0(3)/60.)/60. ! R.A. in real hours
181
! ... other special option: only calculate minimal airmass,
182
! ... i.e. for object on meridian
184
if st .gt. 25. st = alpha
186
inputr(1) = (st-alpha)*15. ! H.A. = ST - R.A. (hour angle
187
write/keyw inputr/r/2/3 {delta},0,0 ! declination
188
rneg = (inputr(2)*3600.)+(inputr(3)*60.)+inputr(4)
189
signs(2:2) = delta(1:1)
190
if rneg .lt. 0.0 signs(2:2) = "-" ! negative declination
191
inputr(5) = exptim ! length of exposure
192
write/keyw inputr/r/6/3 {lat},0,0 ! latitude of observatory
193
signs(1:1) = lat(1:1)
194
rneg = (inputr(6)*3600.)+(inputr(7)*60.)+inputr(8)
195
if rneg .lt. 0.0 signs(1:1) = "-" ! negative latitude
197
run MID_EXE:AIRMASS ! compute airmass
199
write/out "Airmass: {OUTPUTR(1)}" ! display result