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

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

corrections of some headers and parameters and keywords case. change of pro2href to replace proidl

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