source: trunk/SRC/ToBeReviewed/CALCULS/floatlevel2depth.pro @ 114

Last change on this file since 114 was 114, checked in by smasson, 18 years ago

new compilation options (compile_opt idl2, strictarrsubs) in each routine

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 2.3 KB
Line 
1;------------------------------------------------------------
2;------------------------------------------------------------
3;------------------------------------------------------------
4;+
5; NAME:floatlevel2depth
6;
7; PURPOSE: assez comparable a level2depth. C'est la fonction inverse
8; de depth2floatlevel
9;
10; CATEGORY:SANS BOUCLE
11;
12; CALLING SEQUENCE:res=floatlevel2depth(niveau)
13;
14; INPUTS: tableau 2d de niveaux seuil (ou une structure repondant aux
15; criteres de litchamp)
16;
17; KEYWORD PARAMETERS:
18;       /NOMASK: pour ne pas masquer les points terres
19;
20; OUTPUTS: un tableau 2d contenant des profondeurs
21;
22; COMMON BLOCKS:common.pro
23;
24; SIDE EFFECTS:
25;
26; RESTRICTIONS:
27;
28; EXAMPLE:
29;
30;    IDL> a=gdept[jpk-1]/(1.*jpi*jpj)*findgen(jpi,jpj)
31;    IDL> plt, 1e6*(a-floatlevel2depth(depth2floatlevel(a))),/nocontour
32;
33;  ->champ nul a 1e-6 pres
34;
35; MODIFICATION HISTORY:Sebastien Masson (smasson@lodyc.jussieu.fr)
36;                      15/6/2000
37;-
38;------------------------------------------------------------
39;------------------------------------------------------------
40;------------------------------------------------------------
41FUNCTION floatlevel2depth, tab, NOMASK = nomask
42;
43  compile_opt idl2, strictarrsubs
44;
45   tempsun = systime(1)         ; pour key_performance
46@common
47;------------------------------------------------------------
48   flevelin = litchamp(tab)
49; on vire les points a !values.f_nan
50   notanumber = where(finite(flevelin, /nan) EQ 1)
51   if notanumber[0] NE -1 then flevelin[notanumber] = 0
52; on seuil (vire les points terres a valmask par ex)
53   flevelin = 0 > flevelin < (jpk-1)
54; on calcule la profondeur
55   depthup = level2depth(floor(flevelin), /nomask)
56   depthlow= level2depth(ceil(flevelin), /nomask)
57   weight = flevelin-floor(flevelin)
58   res = depthup+weight*(depthlow-depthup)
59; on replace les points a !values.f_nan
60   if notanumber[0] NE -1 then res[notanumber] = !values.f_nan
61; on masque les points terres a valmask
62   if NOT keyword_set(nomask) then begin
63      grille,mask
64      if n_elements(valmask) EQ 0 then valmask = 1e20
65      terre = where((temporary(mask))[*, *, 0] EQ 0)
66      if terre[0] NE -1 then res[terre] = valmask
67   endif
68;------------------------------------------------------------
69   if keyword_set(key_performance) THEN print, 'temps floatlevel2depth', systime(1)-tempsun
70;
71   return, res
72end
Note: See TracBrowser for help on using the repository browser.