function tiny_shift, L,D,L0,D0,K, radians=radians,speed=va,largeshift=largeshift @compile_opt.pro ; On error, return to caller ;+ ; NAME: ; tiny_shift ; PURPOSE: ; Calculates correction for parallax ; CATEGORY: ; Spherical astronomy ; CALLING SEQUENCE: ; RESULT = tiny_shift(L,D,L0,D0,K [,speed=speed,/largeshift,/radians]) ; INPUTS: ; L,D geo-centric celestial coordinates of object (longitude ; and declination) ; L0,D0 geo-centric coordinates of observer ; OPTIONAL INPUT PARAMETERS: ; /largeshift calculates the exact calculation, rather than a first ; order approximation. ; /radians all angles assumed to be in radians (default is degrees) ; OUTPUTS: ; result the topocentric coordinates of the object are given by ; L+result(*,0), D+result(*,1) ; (the structure of the input array is preserved, with ; one dimension (of length 2) added) ; OPTIONAL OUTPUT PARAMETERS: ; speed ; SIDE EFFECTS: ; RESTRICTIONS: ; PROCEDURE: ; > The first order approximation and the speed determination uses the ; equations from `Spherical Astronomy', Green, p. 16, par. 1.7. ; > For parallax calculations K is the ratio of Earth radius (at location ; of the observer) and geo-centric distance of the Moon. ; MODIFICATION HISTORY: ; FEB-1995, Paul Hick (UCSD) ;- radians = keyword_set(radians) largeshift = keyword_set(largeshift) pi = 3.1415927d0 if radians then radeg = 1B else radeg = 180d0/pi A = (L-L0)/radeg sinL = sin(A) & cosL = cos(A) sinD0 = sin(D0/radeg) & cosD0 = cos(D0/radeg) sinD = sin(D /radeg) & cosD = cos(D /radeg) K0 = K*cosD0*pi/43200d0 VA = -K0/cosD*cosL VD = K0*sinD*sinL if LARGESHIFT then begin sinE = cosD0*sinL ; propto sin(E). NOT equal to sin(E) cosE = sinD0*cosD-cosD0*sinD*cosL E = atan(sinE,cosE) sinE = sin(E) & cosE = cos(E) cosTHETA = sinD*sinD0+cosD*cosD0*cosL sinDTHETA = K*sin(acos(cosTHETA))/sqrt(1-2*K*cosTHETA+K*K) cosDTHETA = cos(asin(sinDTHETA)) sinDA = sinDTHETA*sinE ; propto sin(DA). NOT equal to sin(DA) cosDA = cosDTHETA*cosD+sinDTHETA*sinD*cosE DA = atan(sinDA,cosDA) DD = sinD*cosDTHETA-cosD*sinDTHETA*cosE DD = asin(DD)-D/radeg endif else begin DA = K*cosD0/cosD*sinL DD = K*(sinD*cosD0*cosL-cosD*sinD0) endelse DA = DA*radeg & DD = DD*radeg VA = VA*radeg & VD = VD*radeg A = size(Lin) if A(0) eq 0 then begin DA = [DA,DD] & VA = [VA,VD] endif else begin DA = reform ( [reform(DA,A(A(0)+2)),reform(DD,A(A(0)+2))], [A(1:A(0)),2] ) VA = reform ( [reform(VA,A(A(0)+2)),reform(VD,A(A(0)+2))], [A(1:A(0)),2] ) endelse return, DA & end