FUNCTION quantil2,input,npercent,noplot=noplot,above=above ;+ ; NAME: ; quantil2 ; PURPOSE: ; Given an input array, computes the value val so that npercent ; of the input values are below val. ; if above is set, npercent of the input values are above val ; CATEGORY: ; General ; CALLING SEQUENCE: ; val=quantil2(input,npercent) ; INPUTS: ; input = array (any dim) for which mean profile is to be calculated ; npercent = percentage value ; OPTIONAL INPUT PARAMETERS: ; OUTPUTS: ; val = value so that npercent % of the values are below val ; OPTIONAL OUTPUT PARAMETERS: ; COMMON BLOCKS: ; SIDE EFFECTS: ; ; RESTRICTIONS: ; PROCEDURE: ; Uses sort instead of histogram (more efficient than quantil) ; interpol ; MODIFICATION HISTORY: ; 18-Oct-1993, Written by Jean-Philippe Bernard, IPAC. ;- IF N_PARAMS(0) LT 2 THEN BEGIN PRINT,'Calling sequence: val=quantil(input,npercent)' PRINT,'accepted Key-words: /noplot,/above' GOTO, sortie ENDIF si=size(npercent) IF si(0) NE 0 and si(0) NE 1 THEN BEGIN print,'nperc should be a single value or 1D array' goto,sortie ENDIF single=0 IF si(0) EQ 0 THEN single=1 IF single EQ 1 THEN BEGIN IF npercent LT 0 OR npercent GT 100. THEN BEGIN print,'we should have 0