;+ ; NAME: ; LOOKDIRS ; PURPOSE: ; Calculation of Polar Camera look directions at Rabbit Lake, SK, ; from column and row numbers. ; CATEGORY: ; Coordinate transformations. ; CALLING SEQUENCE: ; LOOKDIRS, CAM, COL, ROW, AZIM, ZENANG ; INPUTS: ; CAM: Camera number (0 or 1). ; COL: An array of column numbers (typically the same size ; as a Polar Camera image, with each element containing ; its column number). ; ROW: As above, but row numbers. ; OPTIONAL INPUTS: ; None. ; KEYWORD PARAMETERS: ; None. ; OUTPUTS: ; AZIM: An array of the same dimensions as COL and ROW, ; giving the azimuth angle for each input image ; pixel at image coordinates (column,row). ; ZENANG: As above, giving the zenith angle of each pixel. ; OPTIONAL OUTPUTS: ; None. ; COMMON BLOCKS: ; None. ; SIDE EFFECTS: ; None. ; RESTRICTIONS: ; COL and ROW must be the same size. The AZIM and ZENANG ; arrays are in degrees. ; PROCEDURE: ; The appropriate image transformation parameters are determined ; from the supplied camera number. The column and row numbers ; are converted to ; 'X' and 'Y' distances (in pixels) from the pixel viewing ; the zenith. The (X,Y) pairs are rotated by the measured ; central column azimuth. Pixel distance from the zenith ; pixel is converted to zenith angle using a non-linear ; transformation: ; ; { ( pix_dist ) / } ; zenith angle = (180/pi) * { arcsin( -------- ) / warp } ; { ( stretch ) / } ; ; where 'stretch' is about 200 pixels (for 2x2-binned images) ; and 'warp' is about 0.63. Azimuth is determined from the ; 'X' and 'Y' values after rotation. Negative azimuths are ; incremented by 360 deg. ; EXAMPLE: ; col=REBIN(INDGEN(256),256,256) ; define the column numbers ; row=TRANSPOSE(col) ; same for row numbers ; lookdirs,0,col,row,az,za ; get look directions ; ; for camera 0 ; MODIFICATION HISTORY: ; Modified from CR2AZ.PRO by D P Steele, 27 Sept. 1994. ;- PRO lookdirs,cam,col,row,az,za,bin=bin,site=site ; Set up the transformation parameters CASE cam OF 0: BEGIN ccol=130.575 crow=126.297 stretch=203.723 warp=0.626410 camaz=0.229637 ; radians END 1: BEGIN ccol=127.867 crow=128.401 stretch=199.872 warp=0.644670 camaz=0.237600 ; radians END ELSE: BEGIN MESSAGE,'Illegal camera value: ',STRTRIM(cam,2) END ENDCASE cl=col rw=row IF N_ELEMENTS(bin) GT 0 THEN BEGIN ; binning factor specified. cl=cl*(bin/2) ; transformation assumes 2x2 rw=rw*(bin/2) ; binning, so convert to that ENDIF ; image format dc=cl-ccol ; distances from 'overhead' pixel dr=rw-crow rho=SQRT(dc^2+dr^2) phi=ATAN(dc,-dr); rotate by azimuth of central CCD column xp=COS(phi) yp=SIN(phi) cc=COS(camaz) sc=SIN(camaz) x=xp*cc+yp*sc y=-xp*sc+yp*cc ; Now convert from cartesian to spherical polar coordinates za=!RADEG*(ASIN(rho/stretch)/warp) az=!RADEG*ATAN(-y,x) wn=WHERE(az LT 0.) ; ensure azimuths > 0 IF N_ELEMENTS(wn) GT 1 THEN az(wn)=az(wn)+360. ; Done RETURN END