source: trunk/SRC/ToBeReviewed/CALCULS/floatlevel2depth.pro @ 256

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

improvements/corrections of some *.pro headers

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