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

Last change on this file since 367 was 367, checked in by pinsard, 16 years ago

typo and translation

  • 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 <pro>litchamp</pro>
12; criterions)
13;
14; @returns
15; It is a 3d array containing the mask associated to the 2d sill level array
16;
17; @uses
18; common.pro
19;
20; @history
21; Sebastien Masson (smasson\@lodyc.jussieu.fr)
22;                       17/6/1999
23; Sept 2004: boundary level have 0 values and not 1 (as it was
24; explained before in the header). see:
25; print, array_equal(niveau, total(level2mask(niveau),3))
26;
27; @version
28; $Id$
29;
30;-
31FUNCTION level2mask, tab
32;
33  compile_opt idl2, strictarrsubs
34;
35   tempsun = systime(1)         ; To key_performance
36@common
37;------------------------------------------------------------
38; Reading of the input field and recovery of the size of the used subdomain
39;------------------------------------------------------------
40   niveaux = litchamp(tab)
41   grille,maskterre, -1, -1, -1,nx,ny,nz,firstx,firsty,firstz,lastx,lasty,lastz
42;---------------------------------------------------------------
43; verification of the coherence between the array's size and the defined by
44; 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.