;+ ; NAME: ; LAZ2CR ; PURPOSE: ; Generates arrays of column and row numbers from arrays of ; azimuth and zenith angle, using a geometrical transformation ; that is linear in zenith angle. ; CATEGORY: ; ; CALLING SEQUENCE: ; LAZ2CR, YEAR, MONTH, DAY, CAMERA, FILTER, AZIMUTH, ZENANG $ ; , COLUMN, ROW [, DEGREES=degrees [, BIN=bin [, SITE=site] ] ] ; INPUTS: ; YEAR, MONTH, DAY: Self-evident. Must be a 4-digit year. ; CAMERA: The number of the camera that acquired the images ; to be transformed. ; FILTER: The filter through which the images were acquired. ; AZIMUTH: The array of azimuths, expressed in degrees E of ; geographic N. ; ZENANG: The corresponding array of zenith angles, expressed ; in degrees. ZENANG must have the same structure ; as AZIMUTH. ; KEYWORD PARAMETERS: ; /DEGREES: Set if angle measure in degrees is desired. ; BIN: If set, gives the binning factor for the image ; relative to a 512x512 original image. If not set, ; a 256x256 image is assumed in calculating the column ; and row numbers. ; SITE: A number specifying the location of the Polar Camera ; on the specified date. This information is redundant ; but the keyword is retained for consistency with ; older versions of this routine. ; OUTPUTS: ; COLUMN: An array of the same structure as AZIMUTH and ; ZENANG, giving the image column numbers of the ; directions specified by AZIMUTH and ZENANG. ; ROW: An array of the same structure as AZIMUTH and ; ZENANG, giving the image row numbers of the ; directions specified by AZIMUTH and ZENANG. ; COMMON BLOCKS: ; None. ; SIDE EFFECTS: ; None. ; RESTRICTIONS: ; The input angles must be in degrees. ; PROCEDURE: ; The transformation parameters appropriate to the date are ; read in, and the transformation equations applied to the ; input AZIMUTHs and ZENith ANGles. ; MODIFICATION HISTORY: ; Modified 93/11 from POSITION.PRO by D P Steele. ; Documented 94/06 by D P Steele. ; Modified 94/09/27 by D P Steele: replaced /SMALL keyword ; with BIN=bin keyword for greater flexibility. ; Modified by D P Steele, 18 Oct 1994 to add DEGREES keyword. ;- PRO laz2cr,year,month,day,cam,filt,az,za,cl,rw $ ,degrees=degrees,bin=bin,site=site,small=small IF N_PARAMS() LT 9 THEN BEGIN doc_library,'laz2cr' RETURN ENDIF IF KEYWORD_SET(degrees) THEN ff=!DTOR ELSE ff=1. ; Read in mean parameters for transformation between (row,col) and (az,za) rdmnparm,year,month,day,cam,ccol,crow,stretch,warp,camaz,site=site camaz=camaz/ff ; JHU/APL - convert polar coordinates to rectangular polrec3d,REPLICATE(1.,N_ELEMENTS(az)),za,az,x,y,z,degrees=degrees rot_3d,3,x,y,z,camaz,xp,yp,zp,degrees=degrees ;rotation along the z-axis rho=stretch*za*ff phi=+ATAN(yp,xp) ;variables to be returned cl=ccol-rho*SIN(phi) rw=crow-rho*COS(phi) IF KEYWORD_SET(bin) THEN BEGIN cl=cl/(bin/2) rw=rw/(bin/2) ENDIF RETURN END