source: trunk/CALCULS/level2depth.pro @ 11

Last change on this file since 11 was 2, checked in by opalod, 22 years ago

Initial revision

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 2.8 KB
Line 
1;
2;------------------------------------------------------------
3;------------------------------------------------------------
4;------------------------------------------------------------
5;+
6; NAME:level2depht
7;
8; PURPOSE: permet de passer d''un tableau 2d de niveau au
9; tableau 2d de profondeur correspondant a ces niveaux
10;
11; CATEGORY: SANS BOUCLE
12;
13; CALLING SEQUENCE: res=level2depth(niveau)
14;
15; INPUTS: niveau tableau 2d de niveaux seuil (ou une structure repondant
16; aux criteres de litchamp)
17;
18; KEYWORD PARAMETERS:
19;       /NOMASK: pour ne pas masquer les points terres
20;
21; OUTPUTS: un tableau 2d contenant des profondeurs
22;
23; COMMON BLOCKS:
24;       common.pro
25;
26; SIDE EFFECTS:
27;
28; RESTRICTIONS:
29;
30; EXAMPLE:
31;
32; MODIFICATION HISTORY: Sebastien Masson (smasson@lodyc.jussieu.fr)
33;                       17/6/1999
34;                       14/6/2000 accepte !values.f_nan
35;-
36;------------------------------------------------------------
37;------------------------------------------------------------
38;------------------------------------------------------------
39FUNCTION level2depth, tab, NOMASK = nomask
40   tempsun = systime(1)         ; pour key_performance
41@common
42;------------------------------------------------------------
43; lecture du champ d''entree et recuperation de la taille du sous
44; domaine utilise
45;------------------------------------------------------------
46   niveaux = litchamp(tab)
47   grille,mask,glam,gphi,gdep,nx,ny,nz,premierx,premiery,premierz,dernierx,derniery,dernierz
48;---------------------------------------------------------------
49; verification de la coherence entre la taille du tableau et le domaine definit par 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[premierx:dernierx, premiery:derniery]
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.