source: trunk/SRC/ToBeReviewed/CALCULS/level2mask.pro @ 248

Last change on this file since 248 was 231, checked in by pinsard, 17 years ago

improvements/corrections of some *.pro headers

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.4 KB
Line 
1;+
2;
3; @file_comments
4; Allow to pass from a 2d sill level array to the 3d mask array with 1s in
5; levels above the sill level and 0s below (and on it)
6;
7; @categories
8; Without loop
9;
10; @param TAB {in}{required}{type=2d array}
11; 2d level array of sill level (or a structure respecting litchamp criterions)
12;
13; @returns
14; It is a 3d array containing the mask associated to the 2d sill level array
15;
16; @uses
17; common.pro
18;
19; @history
20; Sebastien Masson (smasson\@lodyc.jussieu.fr)
21;                       17/6/1999
22; Setp 2004: boundary level have 0 values and not 1 (as it was
23; explained before in the header). see:
24; print, array_equal(niveau, total(level2mask(niveau),3))
25;
26;
27; @version
28; $Id$
29;
30;-
31;
32FUNCTION level2mask, tab
33;
34  compile_opt idl2, strictarrsubs
35;
36   tempsun = systime(1)         ; To key_performance
37@common
38;------------------------------------------------------------
39; Reading of the input field and recovery of the size of the used subdomain
40;------------------------------------------------------------
41   niveaux = litchamp(tab)
42   grille,maskterre, -1, -1, -1,nx,ny,nz,firstx,firsty,firstz,lastx,lasty,lastz
43;---------------------------------------------------------------
44; verification of the coherence between the array's size and the defined by domdef domain
45;---------------------------------------------------------------
46   IF ny EQ 1 THEN niveaux = reform(niveaux, nx, ny, /over)
47   taille = size(niveaux)
48   if taille[0] NE 2 then return, report('le champ en entree doit contenir un tableau 2d')
49   case 1 of
50      taille[1] eq jpi and taille[2] eq jpj:niveaux=niveaux[firstx:lastx, firsty:lasty]
51      taille[1] eq  nx and taille[2] eq  ny:
52      else:return, report('Probleme d''adequation entre les tailles du domaine et celle du champ.')
53   endcase
54;------------------------------------------------------------
55;------------------------------------------------------------
56; We transform the 2d leval array in 3d mask array
57;------------------------------------------------------------
58   mask = reform( niveaux[*]#(1./(indgen(nz)+1)), nx, ny, nz )
59   mask = floor(temporary(mask)) < 1
60   mask = temporary(mask)*temporary(maskterre)
61;------------------------------------------------------------
62;------------------------------------------------------------
63;------------------------------------------------------------
64   if keyword_set(key_performance) THEN print, 'temps level2mask', systime(1)-tempsun
65   return, mask
66end
Note: See TracBrowser for help on using the repository browser.