;------------------------------------------------------------ ;------------------------------------------------------------ ;------------------------------------------------------------ ;+ ; NAME:floatlevel2depth ; ; PURPOSE: assez comparable a level2depth. C'est la fonction inverse ; de depth2floatlevel ; ; CATEGORY:SANS BOUCLE ; ; CALLING SEQUENCE:res=floatlevel2depth(niveau) ; ; INPUTS: tableau 2d de niveaux seuil (ou une structure repondant aux ; criteres de litchamp) ; ; KEYWORD PARAMETERS: ; /NOMASK: pour ne pas masquer les points terres ; ; OUTPUTS: un tableau 2d contenant des profondeurs ; ; COMMON BLOCKS:common.pro ; ; SIDE EFFECTS: ; ; RESTRICTIONS: ; ; EXAMPLE: ; ; IDL> a=gdept[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/6/2000 ;- ;------------------------------------------------------------ ;------------------------------------------------------------ ;------------------------------------------------------------ FUNCTION floatlevel2depth, tab, NOMASK = nomask tempsun = systime(1) ; pour key_performance @common ;------------------------------------------------------------ flevelin = litchamp(tab) ; on vire les points a !values.f_nan notanumber = where(finite(flevelin, /nan) EQ 1) if notanumber[0] NE -1 then flevelin[notanumber] = 0 ; on seuil (vire les points terres a valmask par ex) flevelin = 0 > flevelin < (jpk-1) ; on calcule la profondeur depthup = level2depth(floor(flevelin), /nomask) depthlow= level2depth(ceil(flevelin), /nomask) weight = flevelin-floor(flevelin) res = depthup+weight*(depthlow-depthup) ; on replace les points a !values.f_nan if notanumber[0] NE -1 then res[notanumber] = !values.f_nan ; on masque les points terres 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 floatlevel2depth', systime(1)-tempsun ; return, res end