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

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

improvements/corrections of some *.pro headers

  • 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;-
36FUNCTION floatlevel2depth, tab, NOMASK = nomask
37;
38  compile_opt idl2, strictarrsubs
39;
40   tempsun = systime(1)         ; To key_performance
41@common
42;------------------------------------------------------------
43   flevelin = litchamp(tab)
44; We delete points at !values.f_nan
45   notanumber = where(finite(flevelin, /nan) EQ 1)
46   if notanumber[0] NE -1 then flevelin[notanumber] = 0
47; We sill (delete land points at valmask for example)
48   flevelin = 0 > flevelin < (jpk-1)
49; We calculate the depth
50   depthup = level2depth(floor(flevelin), /nomask)
51   depthlow= level2depth(ceil(flevelin), /nomask)
52   weight = flevelin-floor(flevelin)
53   res = depthup+weight*(depthlow-depthup)
54; We put back points at !values.f_nan
55   if notanumber[0] NE -1 then res[notanumber] = !values.f_nan
56; We mask land points at valmask
57   if NOT keyword_set(nomask) then begin
58      grille,mask
59      if n_elements(valmask) EQ 0 then valmask = 1e20
60      terre = where((temporary(mask))[*, *, 0] EQ 0)
61      if terre[0] NE -1 then res[terre] = valmask
62   endif
63;------------------------------------------------------------
64   if keyword_set(key_performance) THEN print, 'temps floatlevel2depth', systime(1)-tempsun
65;
66   return, res
67end
Note: See TracBrowser for help on using the repository browser.