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

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

improvemnts of headers (typo, links)

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