;+ ; NAME: ; CvPrecess ; PURPOSE: ; Converts equatorial or ecliptic coordinates for epoch UT1 to ; epoch UT2, i.e. corrects for precession between the two epochs. ; CATEGORY: ; smei/gen/idl/ephem ; CALLING SEQUENCE: FUNCTION CvPrecess, UT1, UT2, pos , $ degrees = degrees , $ from_ecliptic = from_ecliptic , $ to_ecliptic = to_ecliptic , $ rectangular = rectangular ; CALLS: ; Rotate ; INPUTS: ; UT array[n]; type: time structure ; initial epoch ; UT array[n]; type: time structure ; final epoch ; pos[2,n] or pos[3,n] ; spherical coordinates at start epoch UT1 ; RA or longitude, declination or latitude, and, optional ; the distance (the distance is not modified) ; OPTIONAL INPUT PARAMETERS: ; /degrees if set, all angles are in degrees ; /from_ecliptic ; /to_ecliptic ; by default the input and output are assumed to be in ; equatorial coordinates (RA and declination). ; If /from_ecliptic is set then the input is assumed to be ; in ecliptic coordinates (longitude and latitude) ; If /to_ecliptic is set then the output is in ecliptic ; coordinates ; OUTPUTS: ; pos[2,n] or pos[3,n] ; spherical coordinates at final epoch UT2 ; RA or longitude, declination or latitude, and, optional ; the distance (the distance is not modified) ; INCLUDE: @compile_opt.pro ; CALLS: ; InitVar, CvSky, EulerRotate, CvSky_Precess ; PROCEDURE: ; See R. Green, Spherical Astronomy, Cambridge UP, 1985, Sect. 9.5, p. 217 ; (1) First transform ecliptic longitude and latitude to equatorial right ; ascension and declination (for initial epoch); ; (2) Transform equatorial coordinates for initial epoch to epoch J2000.0; ; (3) Calculate equatorial coordinates for epoch J2000.0 to final epoch; ; (4) Transform back to ecliptic coordinates (for final epoch). ; MODIFICATION HISTORY: ; DEC-2002, Paul Hick (UCSD/CASS; pphick@ucsd.edu) ; Adapted from Fortran subroutine PRECESSION_ROT ;- InitVar, from_ecliptic, /key InitVar, to_ecliptic , /key out = pos ; Convert to equatorial coordinates at TEpoch1 IF from_ecliptic THEN $ out = CvSky(UT1, from_ecliptic=out, /to_equator, degrees=degrees, rectangular=rectangular,/silent) ; Precess from epoch TEPoch1 to J2000 out = EulerRotate(CvSky_Precess(UT1, degrees=degrees), out, degrees=degrees, rectangular=rectangular) ; Precess from J200 to TEpoch2 out = EulerRotate(reverse(-CvSky_Precess(UT2, degrees=degrees),1), out, degrees=degrees, rectangular=rectangular) ; Convert to ecliptic coordinates at TEpoch2 IF to_ecliptic THEN $ out = CvSky(UT2, from_equator=out, /to_ecliptic, degrees=degrees, rectangular=rectangular,/silent) RETURN, out & END