source: trunk/SRC/ToBeReviewed/CALCULS/depth2floatlevel.pro @ 367

Last change on this file since 367 was 367, checked in by pinsard, 16 years ago

typo and translation

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.0 KB
Line 
1;+
2;
3; @file_comments
4; Rather comparable to <pro>depth2level</pro> but here, the calculated level
5; is in float.
6; For example, the level 5.4 correspond to a depth equal
7; to gdep[5]+.4*(gdep[6]-gdep[5])
8;
9; @categories
10; Without loop
11;
12; @param TAB {in}{required}
13; 2d depth array (or a structure respecting <pro>litchamp</pro> criterion)
14;
15; @keyword NOMASK
16; To do not mask land points
17;
18; @returns
19; An 2d array of float containing levels's values.
20;
21; @uses
22; common.pro
23;
24; @restrictions
25; Accept values at !values.f_nan and mask land points at valmask.
26;
27; @examples
28;    IDL> a=(jpk-1)/(1.*jpi*jpj)*findgen(jpi,jpj)
29;    IDL> plt, 1e6*(a-floatlevel2depth(depth2floatlevel(a))),/nocontour
30;
31;  ->champ nul a 1e-6 pres
32;
33; @history
34; Sebastien Masson (smasson\@lodyc.jussieu.fr)
35;                      15/06/2000
36;
37; @version
38; $Id$
39;
40;-
41FUNCTION depth2floatlevel, tab, NOMASK=nomask
42;
43  compile_opt idl2, strictarrsubs
44;
45   tempsun = systime(1)         ; for key_performance
46@common
47;------------------------------------------------------------
48   depthin = litchamp(tab)
49;
50   levelup = depth2level(depthin, /UPPER, /nomask)
51   depthup = level2depth(levelup, /nomask)
52;
53   levellow = depth2level(depthin, /lower, /nomask)
54   depthlow = level2depth(levellow, /nomask)
55; calculate the distance depthlow-depthup and management of the case
56; of this distance is null or equal to !values.f_nan
57   divi = depthlow-depthup
58   nan = where(finite(divi) EQ 0)
59   if nan[0] NE -1 then divi[nan] = 0
60   nan = where(divi EQ 0)
61   if nan[0] NE -1 then divi[nan] = !values.f_nan
62; calculation of the result
63   res = levelup+(depthin-depthup)/divi
64; We mask land point at valmask
65   if NOT keyword_set(nomask) then begin
66      grille,mask
67      if n_elements(valmask) EQ 0 then valmask = 1e20
68      terre = where((temporary(mask))[*, *, 0] EQ 0)
69      if terre[0] NE -1 then res[terre] = valmask
70   endif
71;------------------------------------------------------------
72   if keyword_set(key_performance) THEN print, 'temps depth2floatlevel', systime(1)-tempsun
73;
74   return, res
75end
Note: See TracBrowser for help on using the repository browser.