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

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

modification of headers : mainly blanks around = sign for keywords in declaration of function and pro

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