subroutine latlon( jd, eci, lat, lon ) ! ! Given Julian Date and a rectangular ECI (X,Y,Z) direction vector, ! return the geocentric latitude and longitude. ! ! B. Knapp, 1998-11-18, 2004-03-25 (external acosd, atan2d) ! ! Input ! ! jd - Julian Day Number and fractional day (UT) ! ! eci - vector of length 3 with [x, y, z] direction (norm = 1) ! ! Output ! ! lat - geocentric latitude (North positive, deg) ! ! lon - longitude (West positive, deg) ! C C RCS DATA C C $Header$ C C $Log$ C C implicit none ! ! Input real*8 jd, eci(3) ! ! Output real*8 lat, lon ! ! Local real*8 ra ! ! External functions, subroutines real*8 acosd, atan2d, SidTim external acosd, atan2d, SidTim ! ! Geocentric latitude lat = acosd( -eci(3) )-90.d0 ! ! Get right ascension... ra = atan2d( eci(2), eci(1) ) ! ! ...and longitude lon = mod( SidTim( jd ) - ra, 360.d0 ) if ( lon .lt. 0.d0 ) lon = lon + 360.d0 if ( lon .gt. 180.d0 ) lon = lon - 360.d0 ! return end