FUNCTION moonglow,altitude,phase,wavelength,nm=nm ; This function returns the expected approximate brightness of the ; moon (relative to a full moon directly overhead) given the altitude ; of the moon (degrees above the horizon), phase (percent of full ; illumination), and the wavelength of observation. The wavelength ; is assumed to be given in Angstroms unless the 'nm' keyword is set. ; ; The routine uses data on air mass versus altitude, lunar brightness ; versus phase, and Rayleigh scattering coefficients derived from ; "Astrophysical Quantities" by C.W.Allen. The first invocation ; of the function causes the data to be read into a common block, ; and used from there in subsequent invocations. The tables read ; in are spline-interpolated to derive the appropriate coefficients ; for the particular conditions passed to the routine. COMMON allen,airalt,airmass,tabphase,bright,lambda,abscoeff IF N_ELEMENTS(airalt) EQ 0 THEN BEGIN rdcols,'/aragorn/user2/steele/PAC/field/air-mass.allen' $ ,nair,airalt,airmass rdcols,'/aragorn/user2/steele/PAC/field/moon-phase-law.xephem' $ ,nphase,tabphase,bright rdcols,'/aragorn/user2/steele/PAC/field/atm-absorb.allen' $ ,nwave,lambda,abscoeff ENDIF inwave=wavelength IF KEYWORD_SET(nm) THEN inwave=10*inwave am=SPLINE(airalt,airmass,altitude) br=SPLINE(tabphase,bright,phase) ac=SPLINE(lambda,abscoeff,inwave) RETURN,br*COS(!DTOR*(90.-altitude))*EXP(-ac*am) END