FUNCTION MercatorProj, Pos, degrees=degrees, dabg=dabg, zero_phase=zero_phase ;+ ; NAME: ; MercatorProj ; PURPOSE: ; Transforms latitude and longitude to X and Y coordinates in the ; Mercator map projection. ; CALLING SEQUENCE: ; Pos = MercatorProj(Pos) ; INPUTS: ; Pos array[2,n]; type: float ; n locations in the sky ; Pos[0,n] longitudes ; Pos[1,n] latitudes in [-90.,90.] ; OPTIONAL INPUT PARAMETERS: ; /degrees if set then all angles are in degrees (default: radians) ; ; dabg array[3]; type: float: default: none ; Euler angles for a rotation to be applied to ; 'Pos' prior to the Mercator projection. ; (see href=FishEye=) ; zero_phase scalar; type: float; default: none ; Additional offset applied to phase angle ; (see href=FishEye=) ; OUTPUTS: ; Pos array[2,n]; type: float ; X,Y Cartesian coordinates (same structure as input array) ; (in radians or degrees) ; The longitude is scaled to [-180,+180]. ; INCLUDE: @compile_opt.pro ; On error, return to caller ; CALLS: ; IsType, AngleRange, EulerRotate, SyncDims ; PROCEDURE: ; MODIFICATION HISTORY: ; FEB-2002, Paul Hick (UCSD/CASS; pphick@ucsd.edu) ;- Out = Pos sz = size(Out) Out = reform(Out,sz[1],sz[sz[0]+2]/sz[1], /overwrite) IF IsType(dabg, /defined) THEN $ IF IsType(a,/undefined) THEN a = dabg ELSE a = a+dabg IF IsType(zero_phase, /defined) THEN $ IF IsType(a, /undefined) THEN a = [zero_phase,0,0] ELSE a = a+[zero_phase,0,0] IF IsType(a, /defined) THEN $ Out = EulerRotate(a, Out, degrees=degrees) Out[0,*] = AngleRange(reform(Out[0,*]), /pi, degrees=degrees) SyncDims, Out, size=sz RETURN, Out & END