[2] | 1 | ;------------------------------------------------------------ |
---|
| 2 | ;------------------------------------------------------------ |
---|
| 3 | ;------------------------------------------------------------ |
---|
| 4 | ;+ |
---|
| 5 | ; NAME:floatlevel2depth |
---|
| 6 | ; |
---|
| 7 | ; PURPOSE: assez comparable a level2depth. C'est la fonction inverse |
---|
| 8 | ; de depth2floatlevel |
---|
| 9 | ; |
---|
| 10 | ; CATEGORY:SANS BOUCLE |
---|
| 11 | ; |
---|
| 12 | ; CALLING SEQUENCE:res=floatlevel2depth(niveau) |
---|
| 13 | ; |
---|
| 14 | ; INPUTS: tableau 2d de niveaux seuil (ou une structure repondant aux |
---|
| 15 | ; criteres de litchamp) |
---|
| 16 | ; |
---|
| 17 | ; KEYWORD PARAMETERS: |
---|
| 18 | ; /NOMASK: pour ne pas masquer les points terres |
---|
| 19 | ; |
---|
| 20 | ; OUTPUTS: un tableau 2d contenant des profondeurs |
---|
| 21 | ; |
---|
| 22 | ; COMMON BLOCKS:common.pro |
---|
| 23 | ; |
---|
| 24 | ; SIDE EFFECTS: |
---|
| 25 | ; |
---|
| 26 | ; RESTRICTIONS: |
---|
| 27 | ; |
---|
| 28 | ; EXAMPLE: |
---|
| 29 | ; |
---|
| 30 | ; IDL> a=gdept[jpk-1]/(1.*jpi*jpj)*findgen(jpi,jpj) |
---|
| 31 | ; IDL> plt, 1e6*(a-floatlevel2depth(depth2floatlevel(a))),/nocontour |
---|
| 32 | ; |
---|
| 33 | ; ->champ nul a 1e-6 pres |
---|
| 34 | ; |
---|
| 35 | ; MODIFICATION HISTORY:Sebastien Masson (smasson@lodyc.jussieu.fr) |
---|
| 36 | ; 15/6/2000 |
---|
| 37 | ;- |
---|
| 38 | ;------------------------------------------------------------ |
---|
| 39 | ;------------------------------------------------------------ |
---|
| 40 | ;------------------------------------------------------------ |
---|
| 41 | FUNCTION floatlevel2depth, tab, NOMASK = nomask |
---|
| 42 | tempsun = systime(1) ; pour key_performance |
---|
| 43 | @common |
---|
| 44 | ;------------------------------------------------------------ |
---|
| 45 | flevelin = litchamp(tab) |
---|
| 46 | ; on vire les points a !values.f_nan |
---|
| 47 | notanumber = where(finite(flevelin, /nan) EQ 1) |
---|
| 48 | if notanumber[0] NE -1 then flevelin[notanumber] = 0 |
---|
| 49 | ; on seuil (vire les points terres a valmask par ex) |
---|
| 50 | flevelin = 0 > flevelin < (jpk-1) |
---|
| 51 | ; on calcule la profondeur |
---|
| 52 | depthup = level2depth(floor(flevelin), /nomask) |
---|
| 53 | depthlow= level2depth(ceil(flevelin), /nomask) |
---|
| 54 | weight = flevelin-floor(flevelin) |
---|
| 55 | res = depthup+weight*(depthlow-depthup) |
---|
| 56 | ; on replace les points a !values.f_nan |
---|
| 57 | if notanumber[0] NE -1 then res[notanumber] = !values.f_nan |
---|
| 58 | ; on masque les points terres a valmask |
---|
| 59 | if NOT keyword_set(nomask) then begin |
---|
| 60 | grille,mask |
---|
| 61 | if n_elements(valmask) EQ 0 then valmask = 1e20 |
---|
| 62 | terre = where((temporary(mask))[*, *, 0] EQ 0) |
---|
| 63 | if terre[0] NE -1 then res[terre] = valmask |
---|
| 64 | endif |
---|
| 65 | ;------------------------------------------------------------ |
---|
| 66 | if keyword_set(key_performance) THEN print, 'temps floatlevel2depth', systime(1)-tempsun |
---|
| 67 | ; |
---|
| 68 | return, res |
---|
| 69 | end |
---|