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

Last change on this file since 157 was 157, checked in by navarro, 18 years ago

header improvements + xxx doc

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