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

Last change on this file since 114 was 114, checked in by smasson, 18 years ago

new compilation options (compile_opt idl2, strictarrsubs) in each routine

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 2.5 KB
Line 
1;------------------------------------------------------------
2;------------------------------------------------------------
3;------------------------------------------------------------
4;+
5; NAME:depth2floatlevel
6;
7; PURPOSE: assez comparable a depth2level mais ici le niveau calcule
8; est en float. Par ex le niveau 5.4 correspond a une profondeur egale
9; a gdep[5]+.4*(gdep[6]-gdep[5])
10;
11; CATEGORY: SANS BOUCLE
12;
13; CALLING SEQUENCE:res=depth2floatlevel(depth2d)
14;
15; INPUTS: depth2d tableau 2d de profondeur (ou une structure repondant
16; aux criteres de litchamp)
17;
18; KEYWORD PARAMETERS:
19;       /NOMASK: pour ne pas masquer les points terres
20;
21; OUTPUTS: un tableau 2d de float contenant les valeurs des niveaux.
22;
23; COMMON BLOCKS:common.pro
24;
25; SIDE EFFECTS:accepte les vcaleurs a !values.f_nan et masque les
26; points terres a valmask.
27;
28; RESTRICTIONS:
29;
30; EXAMPLE:
31;
32;    IDL> a=(jpk-1)/(1.*jpi*jpj)*findgen(jpi,jpj)
33;    IDL> plt, 1e6*(a-floatlevel2depth(depth2floatlevel(a))),/nocontour
34;
35;  ->champ nul a 1e-6 pres
36;
37; MODIFICATION HISTORY:Sebastien Masson (smasson@lodyc.jussieu.fr)
38;                      15/06/2000
39;-
40;------------------------------------------------------------
41;------------------------------------------------------------
42;------------------------------------------------------------
43FUNCTION depth2floatlevel, tab, NOMASK = nomask
44;
45  compile_opt idl2, strictarrsubs
46;
47   tempsun = systime(1)         ; pour key_performance
48@common
49;------------------------------------------------------------
50   depthin = litchamp(tab)
51;
52   levelup = depth2level(depthin, /UPPER, /nomask)
53   depthup = level2depth(levelup, /nomask)
54;
55   levellow = depth2level(depthin, /lower, /nomask)
56   depthlow = level2depth(levellow, /nomask)
57; calcule de la distance depthlow-depthup et gestion du cas ou cette
58; distance est nulle ou egale a !values.f_nan
59   divi = depthlow-depthup
60   nan = where(finite(divi) EQ 0)
61   if nan[0] NE -1 then divi[nan] = 0
62   nan = where(divi EQ 0)
63   if nan[0] NE -1 then divi[nan] = !values.f_nan
64; calcule du resultat
65   res = levelup+(depthin-depthup)/divi
66; on masque les points terre a valmask
67   if NOT keyword_set(nomask) then begin
68      grille,mask
69      if n_elements(valmask) EQ 0 then valmask = 1e20
70      terre = where((temporary(mask))[*, *, 0] EQ 0)
71      if terre[0] NE -1 then res[terre] = valmask
72   endif
73;------------------------------------------------------------
74   if keyword_set(key_performance) THEN print, 'temps depth2floatlevel', systime(1)-tempsun
75;
76   return, res
77end
Note: See TracBrowser for help on using the repository browser.