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

Last change on this file since 163 was 163, checked in by navarro, 18 years ago

header improvements : type of parameters and keywords, default values, spell checking + idldoc assistant (IDL online_help)

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