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

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

typo and links in header in some pro files

  • 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 depth2level but here, the calculated level is in float.
5; For example, the level 5.4 correspond to a depth equal
6; to gdep[5]+.4*(gdep[6]-gdep[5])
7;
8; @categories
9; Without loop
10;
11; @param TAB {in}{required}
12; 2d depth array (or a structure respecting <pro>litchamp</pro> criterion)
13;
14; @keyword NOMASK
15; To do not mask land points
16;
17; @returns
18; An 2d array of float containing levels's values.
19;
20; @uses
21; common.pro
22;
23; @restrictions
24; Accept values at !values.f_nan and mask land points at valmask.
25;
26; @examples
27;    IDL> a=(jpk-1)/(1.*jpi*jpj)*findgen(jpi,jpj)
28;    IDL> plt, 1e6*(a-floatlevel2depth(depth2floatlevel(a))),/nocontour
29;
30;  ->champ nul a 1e-6 pres
31;
32; @history
33; Sebastien Masson (smasson\@lodyc.jussieu.fr)
34;                      15/06/2000
35;
36; @version
37; $Id$
38;
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.