;------------------------------------------------------------------------- ; Procedure Name: ra_dec_to_xyz ; Author: J. M. O'Meara ; Purpos: Convert right ascention/declination to 3-D position vector ; ; ; INPUTS: ; dec Declination of object ; ra Right ascention of object ; r Radius scalar ; ; Outputs: ; x,y,z 3-D position vector ; ;------------------------------------------------------------------------ PRO ra_dec_to_xyz,ra,dec,vgeo theta = (90.D - dec)*!DTOR phi = ra*!DTOR vgeo = [SIN(theta)*COS(phi),SIN(theta)*SIN(phi),COS(theta)] END ;------------------------------------------------------------------------- ; Procedure Name: ratopix ; Authors: M. Brittnacher & J. M. O'Meara (Univ. of Washington) ; Date: November 19, 1997 ; Purpose: Calculate the row,col pixel locations of a point, given ; the right ascension and declination of a point in space ; ; Inputs: ; ra Latitude of the point on the earth ; dec Longitude of the point on the earth ; l0 Boresight vector ; a_gci Spacecraft attitude in GCI coordinates ; system Detector: 1 for side A, 2 for side B ; ; Outputs: ; row Pixel row location ; col Pixel column location ; ; Program calls on: ; ra_dec_to_xyz ; vnorm ; unit_vec ; dot_product ;------------------------------------------------------------------------- PRO ratopix,ra,dec,l0,a_gci,system,row,col ;pr = 0.03449D ; 9-bin mean primary detector 9/26/97 (Pyth) ;pc = 0.03983D ; same ; new code 7/28/00 CASE system OF 1: BEGIN pc = 0.03987D ; W. Swift 10/97 pr = 0.03380D ; W. Swift 10/97 END 2: BEGIN pc = 0.04178D ; W. Swift 10/97 pr = 0.03511D ; W. Swift 10/97 ; pc = 0.04159D ; W. Peria 7/28/00 ; pr = 0.03384D ; W. Peria 7/28/00 END ENDCASE ; new approach per K. Clark 8/4/00 pc = tan(pc*!DTOR) ; M. Brittnacher 8/4/00 pr = tan(pr*!DTOR) ; M. Brittnacher 8/4/00 ra_dec_to_xyz,ra,dec,lpix lpix = unit_vec(lpix) ; not necessary ;print, '' ;print, 'ra, dec:', ra, dec ;print, 'lpix:', lpix ;print, 'l0:', l0 ;print, 'a_gci:', a_gci xax = unit_vec(l0) yax = unit_vec(CROSSP(a_gci,l0)) zax = unit_vec(CROSSP(xax,yax)) ; Determine projections of lpix on the x, y and z axes lx = dot_product(lpix,xax) ly = dot_product(lpix,yax) lz = dot_product(lpix,zax) ; obtain tangents -- new approach l = unit_vec([LX,LY,LZ]) tany = l[2]/l[0] tanz = l[1]/l[0] yrot = tany zrot = tanz ; MOF: remove 180 degree ambiguity ; if lx < 0, object in opposite hemisphere ; (i.e., in negative x direction) ; since TAN(n) = TAN(n+180), ; just add a large value to yrot and zrot IF (l[0] LT 0.) THEN BEGIN IF (yrot LT 0) THEN yrot = yrot - 100. $ ELSE yrot = yrot + 100. IF (zrot LT 0) THEN zrot = zrot - 100. $ ELSE zrot = zrot + 100. ENDIF ; Obtain rotation angles -- old approach ;v = unit_vec([LX,LY,LZ]) ;yrot = ATAN(v(2),v(0))/!DTOR ;zrot = ATAN(v(1),v(0))/!DTOR CASE system OF 1: BEGIN row = -yrot/pr + 113.5 col = zrot/pc + 99.5 END 2: BEGIN row = yrot/pr + 113.5 col = zrot/pc + 99.5 END ELSE: BEGIN PRINT,'Failure in system variable [pro: ratopix]' RETURN END ENDCASE ;print, 'row, col:', row, col END