source: trunk/SRC/ToBeReviewed/CALCULS/level2depth.pro @ 163

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

header improvements : type of parameters and keywords, default values, spell checking + idldoc assistant (IDL online_help)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.7 KB
Line 
1;
2;------------------------------------------------------------
3;------------------------------------------------------------
4;------------------------------------------------------------
5;+
6;
7; @file_comments
8; Allows to pass from a 2d level array to a 2d depth array corresponding o these levels
9;
10; @categories
11; Without loop
12;
13; @param TAB {in}{required}{type=2d array}
14; 2d level array of sill levels (or a structure respecting litchamp criterions)
15;
16; @keyword NOMASK
17; To do not mask land points.
18;
19; @returns
20; 2d array containing depths
21;
22; @uses
23; common.pro
24;
25; @history
26; Sebastien Masson (smasson\@lodyc.jussieu.fr)
27;                       17/6/1999
28;                       14/6/2000 accepte !values.f_nan
29;
30; @version
31; $Id$
32;
33;-
34;------------------------------------------------------------
35;------------------------------------------------------------
36;------------------------------------------------------------
37FUNCTION level2depth, tab, NOMASK = nomask
38;
39  compile_opt idl2, strictarrsubs
40;
41   tempsun = systime(1)         ; To key_performance
42@common
43;------------------------------------------------------------
44; Reading of the input field  and recovery of the used subdomain's size
45;------------------------------------------------------------
46   niveaux = litchamp(tab)
47   grille,mask, -1, -1,gdep,nx,ny,nz,firstx,firsty,firstz,lastx,lasty,lastz
48;---------------------------------------------------------------
49; verification of the coherence between array's size and the domain definied by domdef
50;---------------------------------------------------------------
51   taille = size(niveaux)
52   if taille[0] NE 2 then return, report('le champ en entree doit contenir un tableau 2d')
53   case 1 of
54      taille[1] eq jpi and taille[2] eq jpj:niveaux=niveaux[firstx:lastx, firsty:lasty]
55      taille[1] eq  nx and taille[2] eq  ny:
56      else:return, report('Probleme d''adequation entre les tailles du domaine et celle du champ.')
57   endcase
58;---------------------------------------------------------------
59
60   wherenan = where(finite(niveaux, /nan) EQ 1)
61   if wherenan[0] NE -1 then niveaux[wherenan] = 0
62   niveaux = 0 > niveaux < (jpk-1)
63;---------------------------------------------------------------
64   gdep = replicate(1, nx*ny)#gdep
65   niveaux = lindgen(nx*ny)+(nx*ny)*niveaux
66   gdep = reform(gdep[niveaux], nx, ny)
67;
68   if wherenan[0] NE -1 then gdep[wherenan] = !values.f_nan
69   if NOT keyword_set(nomask) then begin
70      if n_elements(valmask) EQ 0 then valmask = 1e20
71      terre = where(mask[*, *, 0] EQ 0)
72      if terre[0] NE -1 then gdep[terre] = valmask
73   endif
74;
75   if keyword_set(key_performance) THEN print, 'temps level2depth', systime(1)-tempsun
76   return, gdep
77end
Note: See TracBrowser for help on using the repository browser.