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

Last change on this file since 163 was 163, checked in by navarro, 18 years ago

header improvements : type of parameters and keywords, default values, spell checking + idldoc assistant (IDL online_help)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.2 KB
Line 
1;------------------------------------------------------------
2;------------------------------------------------------------
3;------------------------------------------------------------
4;+
5;
6; @file_comments
7; Rather comparable to level2depth. It is the invert function of depth2floatlevel
8;
9; @categories
10; Without loop
11;
12; @param TAB
13; 2d array of sill levels (or a structure respecting litchamp criterions)
14;
15; @keyword NOMASK
16; To do not mask land points
17;
18; @returns
19; 2d array containing depthes
20;
21; @uses
22; common.pro
23;
24; @examples
25;    IDL> a=gdept[jpk-1]/(1.*jpi*jpj)*findgen(jpi,jpj)
26;    IDL> plt, 1e6*(a-floatlevel2depth(depth2floatlevel(a))),/nocontour
27;
28;  ->null field at 1e-6 pres
29;
30; @history
31; Sebastien Masson (smasson\@lodyc.jussieu.fr)
32;                      15/6/2000
33;
34; @version
35; $Id$
36;
37;-
38;------------------------------------------------------------
39;------------------------------------------------------------
40;------------------------------------------------------------
41FUNCTION floatlevel2depth, tab, NOMASK = nomask
42;
43  compile_opt idl2, strictarrsubs
44;
45   tempsun = systime(1)         ; To key_performance
46@common
47;------------------------------------------------------------
48   flevelin = litchamp(tab)
49; We delete points at !values.f_nan
50   notanumber = where(finite(flevelin, /nan) EQ 1)
51   if notanumber[0] NE -1 then flevelin[notanumber] = 0
52; We sill (delete land points at valmask for example)
53   flevelin = 0 > flevelin < (jpk-1)
54; We caculate the depth
55   depthup = level2depth(floor(flevelin), /nomask)
56   depthlow= level2depth(ceil(flevelin), /nomask)
57   weight = flevelin-floor(flevelin)
58   res = depthup+weight*(depthlow-depthup)
59; We put back points at !values.f_nan
60   if notanumber[0] NE -1 then res[notanumber] = !values.f_nan
61; We mask land points at 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.