;+
;
; @file_comments
; Allows to pass from a 2d depth sill array to a 3d array of mask
; with one of levels above the sill depth and 0s below.
;
; @categories
; Without loop
;
; @param TAB {type=3d array}
; 2d sill depth array (or a structure respecting litchamp criterions)
;
; @keyword _EXTRA
; Used to pass keywords
;
; @returns
; It is a 3d array containing the mask associated to the 2d sill depth array
;
; @uses
; common
;
; @history
; Sebastien Masson (smasson\@lodyc.jussieu.fr)
; 17/6/1999
;
; @version
; $Id$
;
;-
FUNCTION depth2mask, tab, _EXTRA=ex
;
compile_opt idl2, strictarrsubs
;
tempsun = systime(1) ; For key_performance
@common
;------------------------------------------------------------
; We transform the 2d depth value in a 2d array of levels corresponding to depths
;------------------------------------------------------------
niveaux = depth2level(tab, _extra = ex)
IF niveaux[0] EQ -1 THEN return, -1
;------------------------------------------------------------
; We transform the 2d array in a 3d array of mask
;------------------------------------------------------------
mask = level2mask(niveaux)
;------------------------------------------------------------
if keyword_set(key_performance) NE 0 THEN print, 'temps depth2mask', systime(1)-tempsun
return, mask
end