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

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

modification of headers : mainly blanks around = sign for keywords in declaration of function and pro

  • 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;-
40FUNCTION depth2floatlevel, tab, NOMASK=nomask
41;
42  compile_opt idl2, strictarrsubs
43;
44   tempsun = systime(1)         ; for key_performance
45@common
46;------------------------------------------------------------
47   depthin = litchamp(tab)
48;
49   levelup = depth2level(depthin, /UPPER, /nomask)
50   depthup = level2depth(levelup, /nomask)
51;
52   levellow = depth2level(depthin, /lower, /nomask)
53   depthlow = level2depth(levellow, /nomask)
54; calculate the distance depthlow-depthup and management of the case
55; of this distance is null or equal to !values.f_nan
56   divi = depthlow-depthup
57   nan = where(finite(divi) EQ 0)
58   if nan[0] NE -1 then divi[nan] = 0
59   nan = where(divi EQ 0)
60   if nan[0] NE -1 then divi[nan] = !values.f_nan
61; calculation of the result
62   res = levelup+(depthin-depthup)/divi
63; We mask land point at valmask
64   if NOT keyword_set(nomask) then begin
65      grille,mask
66      if n_elements(valmask) EQ 0 then valmask = 1e20
67      terre = where((temporary(mask))[*, *, 0] EQ 0)
68      if terre[0] NE -1 then res[terre] = valmask
69   endif
70;------------------------------------------------------------
71   if keyword_set(key_performance) THEN print, 'temps depth2floatlevel', systime(1)-tempsun
72;
73   return, res
74end
Note: See TracBrowser for help on using the repository browser.