source: trunk/CALCULS/depth2floatlevel.pro @ 2

Last change on this file since 2 was 2, checked in by opalod, 22 years ago

Initial revision

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 2.4 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   tempsun = systime(1)         ; pour key_performance
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)
54; calcule de la distance depthlow-depthup et gestion du cas ou cette
55; distance est nulle ou egale a !values.f_nan
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
61; calcule du resultat
62   res = levelup+(depthin-depthup)/divi
63; on masque les points terre a valmask
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;------------------------------------------------------------
71   if keyword_set(key_performance) THEN print, 'temps depth2floatlevel', systime(1)-tempsun
72;
73   return, res
74end
Note: See TracBrowser for help on using the repository browser.