source: trunk/SRC/ToBeReviewed/CALCULS/floatlevel2depth.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.2 KB
RevLine 
[2]1;------------------------------------------------------------
2;------------------------------------------------------------
3;------------------------------------------------------------
4;+
5;
[142]6; @file_comments
[163]7; Rather comparable to level2depth. It is the invert function of depth2floatlevel
[2]8;
[142]9; @categories
10; Without loop
[2]11;
[142]12; @param TAB
13; 2d array of sill levels (or a structure respecting litchamp criterions)
[2]14;
[142]15; @keyword NOMASK
16; To do not mask land points
[2]17;
[142]18; @returns
19; 2d array containing depthes
[2]20;
[142]21; @uses
22; common.pro
[2]23;
[142]24; @examples
[2]25;    IDL> a=gdept[jpk-1]/(1.*jpi*jpj)*findgen(jpi,jpj)
26;    IDL> plt, 1e6*(a-floatlevel2depth(depth2floatlevel(a))),/nocontour
27;
[142]28;  ->null field at 1e-6 pres
[2]29;
[142]30; @history
[157]31; Sebastien Masson (smasson\@lodyc.jussieu.fr)
[2]32;                      15/6/2000
[142]33;
34; @version
35; $Id$
36;
[2]37;-
38;------------------------------------------------------------
39;------------------------------------------------------------
40;------------------------------------------------------------
41FUNCTION floatlevel2depth, tab, NOMASK = nomask
[114]42;
43  compile_opt idl2, strictarrsubs
44;
[142]45   tempsun = systime(1)         ; To key_performance
[2]46@common
47;------------------------------------------------------------
48   flevelin = litchamp(tab)
[142]49; We delete points at !values.f_nan
[2]50   notanumber = where(finite(flevelin, /nan) EQ 1)
51   if notanumber[0] NE -1 then flevelin[notanumber] = 0
[142]52; We sill (delete land points at valmask for example)
[2]53   flevelin = 0 > flevelin < (jpk-1)
[142]54; We caculate the depth
[2]55   depthup = level2depth(floor(flevelin), /nomask)
56   depthlow= level2depth(ceil(flevelin), /nomask)
57   weight = flevelin-floor(flevelin)
58   res = depthup+weight*(depthlow-depthup)
[142]59; We put back points at !values.f_nan
[2]60   if notanumber[0] NE -1 then res[notanumber] = !values.f_nan
[142]61; We mask land points at valmask
[2]62   if NOT keyword_set(nomask) then begin
63      grille,mask
64      if n_elements(valmask) EQ 0 then valmask = 1e20
65      terre = where((temporary(mask))[*, *, 0] EQ 0)
66      if terre[0] NE -1 then res[terre] = valmask
67   endif
68;------------------------------------------------------------
69   if keyword_set(key_performance) THEN print, 'temps floatlevel2depth', systime(1)-tempsun
70;
71   return, res
72end
Note: See TracBrowser for help on using the repository browser.