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

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

modification of some headers (+some corrections) to prepare usage of the new idldoc

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.0 KB
RevLine 
[2]1;+
[231]2;
[142]3; @file_comments
[226]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
[142]6; to gdep[5]+.4*(gdep[6]-gdep[5])
[2]7;
[226]8; @categories
[157]9; Without loop
[2]10;
[142]11; @param TAB {in}{required}
[268]12; 2d depth array (or a structure respecting <pro>litchamp</pro> criterion)
[2]13;
[142]14; @keyword NOMASK
15; To do not mask land points
[2]16;
[142]17; @returns
18; An 2d array of float containing levels's values.
[2]19;
[142]20; @uses
21; common.pro
[2]22;
[142]23; @restrictions
24; Accept values at !values.f_nan and mask land points at valmask.
[2]25;
[142]26; @examples
[2]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;
[226]32; @history
[157]33; Sebastien Masson (smasson\@lodyc.jussieu.fr)
[2]34;                      15/06/2000
[226]35;
[142]36; @version
37; $Id$
38;
[2]39;-
40FUNCTION depth2floatlevel, tab, NOMASK = nomask
[114]41;
42  compile_opt idl2, strictarrsubs
43;
[142]44   tempsun = systime(1)         ; for key_performance
[2]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)
[226]54; calculate the distance depthlow-depthup and management of the case
55; of this distance is null or equal to !values.f_nan
[2]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
[142]61; calculation of the result
[2]62   res = levelup+(depthin-depthup)/divi
[142]63; We mask land point at valmask
[2]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;------------------------------------------------------------
[226]71   if keyword_set(key_performance) THEN print, 'temps depth2floatlevel', systime(1)-tempsun
[2]72;
73   return, res
74end
Note: See TracBrowser for help on using the repository browser.