;---------------------------------------------------------------------- ; NAME: ; update_aimass ; PURPOSE: ; Computes the airmass for the supplied values. ; ; EXPLANATION: ; ; CALLING SEQUENCE: ; update_airmass, ra, dec, lat, long, ut, date ; INPUTS: ; ra - the ra of the object in todays coordinates in hours ; dec - the dec of the obj. in the date's coords in degrees ; lat - latitude of the observer in degrees ; long - longitude of the observer in degrees ; ut - time of the observation ; date - the date mo/day/year as seen in the header of a MIRSI ; camera file ; ; OPTIONAL INPUTS: ; ra2 - the RA of the object precessed to the appropriate epoch ; dec2 - the Dec of the object precessed to the appropriate epoch ; OPTIONAL INPUT KEYWORDS: ; ; OUTPUTS: ; returns the calculated airmass. ; OPTIONAL OUTPUTS: ; ; NOTES: ; ; PROCEDURE CALLS: ; REVISION HISTORY: ;------------------------------------------------------------------------- FUNCTION airmass2, ra, dec, lat, long, ut, date ;constants pi=3.1415926 deg2rad = pi/180.0 hour2rad = pi/12.0 ;put the variables into appropriate units ra = ra * 12.0 / pi dec = dec * 180.0 / pi lat = lat * 180.0 / pi long = long * 180.0 / pi ut = ut * 12.0 / pi ;convert the date to yr, mo, day mo = strmid(date,0,strpos(date, '/')) day = strmid(date, strpos(date,'/')+1, strpos(date,'/', /REVERSE_SEARCH) - 1 - strpos(date,'/')) year = strmid(date, strpos(date,'/', /REVERSE_SEARCH)+1) ;determine the number of days between the autumnal equinox and the ;specified date days = ymd2dn(year,mo,day) - ymd2dn(year,9,21) ;calculate the local siderial time and the hour angle. st = UT + 360.0/15.0/365.2564*days lst = st - long/15.0 hour_angle = lst - ra ;put all of the information in radians. latrad = lat * deg2rad hourrad = hour_angle * hour2rad decrad = dec * deg2rad ;calculate the altitude angle. alt = asin(sin(decrad)*sin(latrad) + cos(decrad)*cos(latrad)*cos(hourrad)) ;calculate the zenith angle z_angle = pi/2.0-alt ;calculate the secant of the zenith angle secant = 1.0 / cos(z_angle) ;calculate the secant angle -1 for the airmass calculation sec_1 = secant -1.0 ;calculate the airmass ;functional form comes from: ; Astronomical observations by G. Walker, Cambridge U. Press, New york 1982 airmass = secant - 0.0018167*sec_1 - 0.002875* sec_1^2 -0.0008083 * sec_1^3 ;return the airmass return, airmass end