FUNCTION vu_weight, t0, tt, triangle=triangle ;+ ; NAME: ; vu_weight ; PURPOSE: ; Set weight to be used by href=vu_mean= to get weighted mean ; of 3D tomography data ; CATEGORY: ; Tomography ; CALLING SEQUENCE: ; ww = vu_weight(t0, tt, triangle=triangle) ; INPUTS: ; t0 array[1]; type: double ; time origin as Carrington variable ; tt array[*]; type: double ; times for which weight factors are needed ; (as Carrington variable) ; OPTIONAL INPUT PARAMETERS: ; triangle array[4]; type: double ; parameters defining weight function ; OUTPUTS: ; ww array[*]; type: double ; weight factors ; INCLUDE: @compile_opt.pro ; On error, return to caller ; CALLS: ; IsType, TimeUnit, TimeOp ; PROCEDURE: ; Units in triangle are fraction of Carrington rotation ; triangle[0]: position of top of triangle ; triangle[1]: left corner of triangle ; triangle[2]: right corner of triangle ; triangle[3]; weight at top of triangle ; MODIFICATION HISTORY: ; MAR-2001, Paul Hick (UCSD/CASS; pphick@ucsd.edu) ;- CASE IsType(triangle, /defined) OF 0: w = replicate(1.0, n_elements(tt)) 1: BEGIN ; Time difference with shifted origin uday = TimeUnit(/day) dt = TimeOp(/subtract, tt, TimeOp(/add,t0,TimeSet(/diff,day=triangle[0])), uday) ; triangle[1] is negative, triangle[2] is positive w = 1-dt*( (dt LT 0)/triangle[1]+(dt GE 0)/triangle[2] ) w = (triangle[3]*w) > 0 END ENDCASE RETURN, w & END