;+ ; NAME: ; SOLZEN ; ; PURPOSE: ; Calculates solar zenith angle ; ; CATEGORY: ; Utility ; ; CALLING SEQUENCE: ; result = solzen(date,time,pos) ; ; INPUT PARAMETERS: ; date date in yyyyddd format; longword integer scalar ; time universal time in seconds; floating point scalar ; pos position vector in km, ECI coords; fltarr(3,*) ; ; OUTPUT PARAMETERS: ; sza solar zenith angle, degrees; floating point scalar ; ; COMMON BLOCKS: ; none ; ; ROUTINES USED: ; SUNCOR - calculates coordinates of sun and Greenwich sidereal time ; ; PROCEDURE: ; Calculates solar zenith angle, based on angle between position ; vector and the solar vector, obtained from a solar ephemeris routine. ; Arrays of vectors are OK. ; ; ; MODIFICATION HISTORY: ; 12/01 Version 1.0 Stan Solomon ;- function solzen, date, time, pos ; Find solar declination and right ascension: suncor, date, time, sdec, sra, gst ; Calculate length of position vector: r=sqrt(pos[0,*]^2+pos[1,*]^2+pos[2,*]^2) ; Normalize position vector: pn=pos pn[0,*]=pos[0,*]/r pn[1,*]=pos[1,*]/r pn[2,*]=pos[2,*]/r ; Find geocentric latitude and right ascension: lat = asin(pn[2,*]) ra = atan(pn[1,*],pn[0,*]) ; Calculate solar zenith angle: sza = acos(sin(sdec)*sin(lat)+cos(sdec)*cos(lat)*cos(ra-sra)) ; Convert radians into degrees: sza = sza * 180./!pi return,sza end