;------------------------------------------------------------ ;------------------------------------------------------------ ;------------------------------------------------------------ ;+ ; NAME:depth2floatlevel ; ; PURPOSE: assez comparable a depth2level mais ici le niveau calcule ; est en float. Par ex le niveau 5.4 correspond a une profondeur egale ; a gdep[5]+.4*(gdep[6]-gdep[5]) ; ; CATEGORY: SANS BOUCLE ; ; CALLING SEQUENCE:res=depth2floatlevel(depth2d) ; ; INPUTS: depth2d tableau 2d de profondeur (ou une structure repondant ; aux criteres de litchamp) ; ; KEYWORD PARAMETERS: ; /NOMASK: pour ne pas masquer les points terres ; ; OUTPUTS: un tableau 2d de float contenant les valeurs des niveaux. ; ; COMMON BLOCKS:common.pro ; ; SIDE EFFECTS:accepte les vcaleurs a !values.f_nan et masque les ; points terres a valmask. ; ; RESTRICTIONS: ; ; EXAMPLE: ; ; IDL> a=(jpk-1)/(1.*jpi*jpj)*findgen(jpi,jpj) ; IDL> plt, 1e6*(a-floatlevel2depth(depth2floatlevel(a))),/nocontour ; ; ->champ nul a 1e-6 pres ; ; MODIFICATION HISTORY:Sebastien Masson (smasson@lodyc.jussieu.fr) ; 15/06/2000 ;- ;------------------------------------------------------------ ;------------------------------------------------------------ ;------------------------------------------------------------ FUNCTION depth2floatlevel, tab, NOMASK = nomask ; compile_opt idl2, strictarrsubs ; tempsun = systime(1) ; pour key_performance @common ;------------------------------------------------------------ depthin = litchamp(tab) ; levelup = depth2level(depthin, /UPPER, /nomask) depthup = level2depth(levelup, /nomask) ; levellow = depth2level(depthin, /lower, /nomask) depthlow = level2depth(levellow, /nomask) ; calcule de la distance depthlow-depthup et gestion du cas ou cette ; distance est nulle ou egale a !values.f_nan divi = depthlow-depthup nan = where(finite(divi) EQ 0) if nan[0] NE -1 then divi[nan] = 0 nan = where(divi EQ 0) if nan[0] NE -1 then divi[nan] = !values.f_nan ; calcule du resultat res = levelup+(depthin-depthup)/divi ; on masque les points terre a valmask if NOT keyword_set(nomask) then begin grille,mask if n_elements(valmask) EQ 0 then valmask = 1e20 terre = where((temporary(mask))[*, *, 0] EQ 0) if terre[0] NE -1 then res[terre] = valmask endif ;------------------------------------------------------------ if keyword_set(key_performance) THEN print, 'temps depth2floatlevel', systime(1)-tempsun ; return, res end