;------------------------------------------------------------------------- ; Procedure Name: lltodr ; Author: J. M. O'Meara ; Purpos: Convert latitude/longitude to 3-D position vector ; ; ; INPUTS: ; lat Latitude of the point on the earth ; lon Longitude of the point on the earth ; r Radius scalar ; ; Outputs: ; x,y,z 3-D position vector ; ;------------------------------------------------------------------------ PRO lltodr,lat,lon,r,x,y,z dtor = !DPI/180.D theta = (90.D - lat)*dtor phi = lon*dtor x = r*SIN(theta)*COS(phi) y = r*SIN(theta)*SIN(phi) z = r*COS(theta) END ;------------------------------------------------------------------------- ; Procedure Name: lltopix_arr ; 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 latitude and longitude of the point on the earth ; and the spacecraft's orbit and attitude ; ; Inputs: ; lat Latitude of the point on the earth ; lon Longitude of the point on the earth ; emis_hgt Radiation emission height (km) ; xax X axis: direction of l0 ; yax Y axis: zax X xax ; zax Z axis: direction in plane of xax and att perp to xax ; orb GCI orbital postion (km) ; time Event time vector ; irotm INVERSE of rotation matrix supplied by ic_cgi_to_geo ; ; Outputs: ; row Pixel row location ; col Pixel column location ; angle Angle between Lpix and pos ; ; Program calls on: ; lltodr ;------------------------------------------------------------------------- PRO lltopix_arr,lat,lon,emis_hgt,xax,yax,zax,orb,time,system,$ row_arr,col_arr,angle,irotm dtor = !DPI/180.D rtod = 180.D/!DPI ;fov = DOUBLE(8.0) ;ncols = 200 ;nrows = 228 ;pc = DOUBLE(fov/ncols) ;pr = DOUBLE(fov/nrows) ; 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 ;radius of the earth (km) r = 6371.D + emis_hgt ;convert latitude,longitude to p_geo vector lltodr,lat,lon,r,x,y,z ; obtain position vector for point on Earth's surface posx = irotm(0,0)*x + irotm(0,1)*y + irotm(0,2)*z posy = irotm(1,0)*x + irotm(1,1)*y + irotm(1,2)*z posz = irotm(2,0)*x + irotm(2,1)*y + irotm(2,2)*z tmpx = posx - orb(0) tmpy = posy - orb(1) tmpz = posz - orb(2) Ntmp = SQRT(tmpx*tmpx + tmpy*tmpy + tmpz*tmpz) Npos = SQRT(posx*posx + posy*posy + posz*posz) ; obtain unit vector in look direction for this pixel lpixx = tmpx/Ntmp lpixy = tmpy/Ntmp lpixz = tmpz/Ntmp ; Determine angle between Lpix and pos angle = ACOS((lpixx*posx + lpixy*posy + lpixz*posz)/Npos) ; Determine projections of lpix on the x, y and z axes lx = lpixx*xax(0) + lpixy*xax(1) + lpixz*xax(2) ly = lpixx*yax(0) + lpixy*yax(1) + lpixz*yax(2) lz = lpixx*zax(0) + lpixy*zax(1) + lpixz*zax(2) ; obtain tangents -- new approach tany = lz/lx tanz = ly/lx yrot = tany zrot = tanz ;yrot = rtod*ATAN(lz,lx) ;zrot = rtod*ATAN(ly,lx) CASE system OF 1: BEGIN row_arr = -yrot/pr + 113.5 col_arr = zrot/pc + 99.5 END 2: BEGIN row_arr = yrot/pr + 113.5 col_arr = zrot/pc + 99.5 END ELSE: BEGIN PRINT,'Failure in system variable [pro: lltopix]' RETURN END ENDCASE ; lx should not be negative --> behind spacecraft out_of_fov = WHERE(lx LE 0., num_out_of_fov) ; following the procedure in final_prep_geo.pro in studio.pro ; -- setting invalid points to -101 IF (num_out_of_fov GT 0) THEN BEGIN row_arr[out_of_fov] = -101 col_arr[out_of_fov] = -101 ENDIF END