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

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

corrections of some misspellings in some *.pro

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.6 KB
RevLine 
[2]1;
2;------------------------------------------------------------
3;------------------------------------------------------------
4;------------------------------------------------------------
5;+
6;
[142]7; @file_comments
8; Allows to pass from a 2d level array to a 2d depth array corresponding o these levels
[2]9;
[142]10; @categories
11; Without loop
[2]12;
[163]13; @param TAB {in}{required}{type=2d array}
[142]14; 2d level array of sill levels (or a structure respecting litchamp criterions)
[2]15;
[142]16; @keyword NOMASK
17; To do not mask land points.
[2]18;
[224]19; @returns
[163]20; 2d array containing depths
[2]21;
[142]22; @uses
23; common.pro
[2]24;
[142]25; @history
[157]26; Sebastien Masson (smasson\@lodyc.jussieu.fr)
[142]27;                       17/6/1999
28;                       14/6/2000 accepte !values.f_nan
[2]29;
[142]30; @version
31; $Id$
[2]32;
33;-
34;------------------------------------------------------------
35;------------------------------------------------------------
36;------------------------------------------------------------
37FUNCTION level2depth, tab, NOMASK = nomask
[114]38;
39  compile_opt idl2, strictarrsubs
40;
[142]41   tempsun = systime(1)         ; To key_performance
[2]42@common
43;------------------------------------------------------------
[142]44; Reading of the input field  and recovery of the used subdomain's size
[2]45;------------------------------------------------------------
46   niveaux = litchamp(tab)
[25]47   grille,mask, -1, -1,gdep,nx,ny,nz,firstx,firsty,firstz,lastx,lasty,lastz
[2]48;---------------------------------------------------------------
[226]49; verification of the coherence between array's size and the domain defined by domdef
[2]50;---------------------------------------------------------------
51   taille = size(niveaux)
[224]52   if taille[0] NE 2 then return, report('input field must be a 2d array')
[2]53   case 1 of
[25]54      taille[1] eq jpi and taille[2] eq jpj:niveaux=niveaux[firstx:lastx, firsty:lasty]
[2]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;
[224]75   if keyword_set(key_performance) THEN print, 'temps level2depth', systime(1)-tempsun
[2]76   return, gdep
77end
Note: See TracBrowser for help on using the repository browser.