;+ ; NAME: ; ScEarth ; PURPOSE: ; Returns the heliographic or ecliptic longitude of the Earth for a given time ; CALLING SEQUENCE: FUNCTION ScEarth, T, $ ecliptic = ecliptic , $ degrees = degrees , $ eastlimb = eastlimb , $ westlimb = westlimb ; INPUTS: ; T scalar, array; type: standard time structure ; times ; OPTIONAL INPUTS: ; /degrees if set, angles are in degrees (default: radians) ; /ecliptic if set, the ecliptic longitude is returned ; /eastlimb if set, the longitude of the east limb is returned ; /westlimb if set, the longitude of the west limb is returned ; OUTPUTS: ; ScEarth heliographic longitude (degrees, 0<=EARTH<360) ; INCLUDE: @compile_opt.pro ; On error, return to caller ; CALLS: ; jpl_eph, CvSky, SubArray, ToRadians, InitVar ; PROCEDURE: ; MODIFICATION HISTORY: ; JAN-1991, Paul Hick (UCSD/CASS) ; JUL-1993, Paul Hick (UCSD/CASS), added option to return ecliptic longitude ; OCT-1994, Paul Hick (UCSD/CASS), converted from F77 (functions SC_EARTH, ; SC_EARTH_ELIMB, SC_EARTH_WLIMB) ; FEB-2007, Paul Hick (UCSD/CASS; pphick@ucsd.edu) ; Replaced NewcombSun call by call to jpl_eph. ; The difference should be a few thousands of a degree. ;- InitVar, eastlimb, /key InitVar, westlimb, /key InitVar, ecliptic, /key ; Heliocentric ecliptic coordinates Earth ;L = NewcombSun(T, /heliocentric) L = jpl_eph(T,/location,/to_sphere,/precess,/to_ecliptic) Off = (westlimb+eastlimb*3)*(!dpi/2.0d0) IF Off NE 0 THEN L = SubArray(L, add=Off) ; Apply offset for east/west limb to longitude ; Convert from ecliptic to heliographic coordinates IF NOT ecliptic THEN L = CvSky(T, from_ecliptic=L, /to_heliographic, /silent) RETURN, SubArray(L)/ToRadians(degrees=degrees) ; Return longitude only END