[2] | 1 | ;+ |
---|
| 2 | ; |
---|
[142] | 3 | ; @file_comments |
---|
[231] | 4 | ; Allows to pass a field referring to the grid V on the grid T, |
---|
| 5 | ; thanks to the average: |
---|
| 6 | ; res = 0.5*(res + shift(res, 1, 0)) |
---|
[2] | 7 | ; |
---|
[231] | 8 | ; @categories |
---|
[157] | 9 | ; Grid |
---|
[2] | 10 | ; |
---|
[142] | 11 | ; @param TEMP {in}{required} |
---|
| 12 | ; A 2, 3 or 4d array |
---|
[2] | 13 | ; |
---|
[142] | 14 | ; @returns |
---|
| 15 | ; res, a 2, 3 or 4d array |
---|
[2] | 16 | ; |
---|
[142] | 17 | ; @uses |
---|
| 18 | ; common.pro |
---|
[2] | 19 | ; |
---|
[231] | 20 | ; @restrictions |
---|
| 21 | ; Force parameters of the zoom on the grid V to be the same as |
---|
[142] | 22 | ; those on the grid T. |
---|
[2] | 23 | ; |
---|
[231] | 24 | ; @restrictions |
---|
| 25 | ; Points which can not be calculated are put at the value NaN |
---|
[142] | 26 | ; consecrated by IDL: !values.f_nan |
---|
[2] | 27 | ; |
---|
[142] | 28 | ; @history |
---|
| 29 | ; From Marina Levy's programs |
---|
[157] | 30 | ; Sebastien Masson (smasson\@lodyc.jussieu.fr): |
---|
[142] | 31 | ; Validation. 5/6/2000 |
---|
[2] | 32 | ; |
---|
[142] | 33 | ; @version |
---|
| 34 | ; $Id$ |
---|
[2] | 35 | ; |
---|
[231] | 36 | ; @todo |
---|
| 37 | ; seb: nom du input? |
---|
[2] | 38 | ; |
---|
| 39 | ;- |
---|
[231] | 40 | ; |
---|
[2] | 41 | FUNCTION v2t, temp |
---|
[114] | 42 | ; |
---|
| 43 | compile_opt idl2, strictarrsubs |
---|
| 44 | ; |
---|
[13] | 45 | @cm_4mesh |
---|
| 46 | @cm_4data |
---|
| 47 | @cm_4cal |
---|
| 48 | IF NOT keyword_set(key_forgetold) THEN BEGIN |
---|
| 49 | @updatenew |
---|
| 50 | ENDIF |
---|
| 51 | ;--------------------------------------------------------- |
---|
[2] | 52 | res = temp |
---|
[142] | 53 | ;We force nxt=nxv, etc ... |
---|
[13] | 54 | firstxt = firstxv |
---|
| 55 | lastxt = lastxv |
---|
| 56 | firstyt = firstyv |
---|
| 57 | lastyt = lastyv |
---|
[2] | 58 | nxt = nxv |
---|
| 59 | nyt = nyv |
---|
| 60 | vargrid = 'T' |
---|
| 61 | if NOT keyword_set(valmask) then valmask = 1e20 |
---|
[13] | 62 | lat1 = gphit[0, firstyt] |
---|
| 63 | lat2 = gphiv[0, lastyv] |
---|
[2] | 64 | |
---|
[142] | 65 | ; case on tha array's size and application |
---|
[2] | 66 | taille = size(temp) |
---|
[231] | 67 | CASE taille[0] OF |
---|
[2] | 68 | 1: res = -1 |
---|
[231] | 69 | 2: BEGIN |
---|
[2] | 70 | case 1 of |
---|
| 71 | taille[1] eq nxv and taille[2] eq nyv: |
---|
| 72 | taille[1] eq jpi and taille[2] eq jpj: $ |
---|
[13] | 73 | res=res[firstxv:lastxv, firstyv:lastyv] |
---|
[2] | 74 | else: $ |
---|
| 75 | return, report('Probleme d''adequation entre les tailles du domaine et de la boite.') |
---|
| 76 | endcase |
---|
[13] | 77 | mask = (vmask())[firstxv:lastxv, firstyv:lastyv, 0] |
---|
[231] | 78 | terre = where(mask EQ 0) |
---|
[2] | 79 | IF terre[0] NE -1 THEN res[terre] = !values.f_nan |
---|
| 80 | res = 0.5*(res + shift(res, 0, +1)) |
---|
| 81 | res[*, 0] = !values.f_nan |
---|
[13] | 82 | mask = tmask[firstxv:lastxv, firstyv:lastyv, 0] |
---|
[231] | 83 | terre = where(mask EQ 0) |
---|
[2] | 84 | IF terre[0] NE -1 THEN res[terre] = valmask |
---|
| 85 | END |
---|
[231] | 86 | 3: BEGIN |
---|
[2] | 87 | case 1 of |
---|
| 88 | taille[1] eq nxv and taille[2] eq nyv AND taille[3] EQ nzt: |
---|
| 89 | taille[1] eq nxv and taille[2] eq nyv AND taille[3] EQ jpk: $ |
---|
[13] | 90 | res=res[*, *, firstzt:lastzt] |
---|
[2] | 91 | taille[1] eq nxv and taille[2] eq nyv AND taille[3] EQ jpt: |
---|
| 92 | taille[1] eq jpi and taille[2] eq jpj AND taille[3] EQ jpk: $ |
---|
[13] | 93 | res=res[firstxv:lastxv, firstyv:lastyv, firstzt:lastzt] |
---|
[2] | 94 | taille[1] eq jpi and taille[2] eq jpj AND taille[3] EQ jpt: $ |
---|
[13] | 95 | res=res[firstxv:lastxv, firstyv:lastyv, *] |
---|
[2] | 96 | else: $ |
---|
| 97 | return, report('Probleme d''adequation entre les tailles du domaine et de la boite.') |
---|
| 98 | ENDCASE |
---|
| 99 | if taille[3] EQ jpt then begin |
---|
[13] | 100 | mask = (vmask())[firstxv:lastxv, firstyv:lastyv, lastzt*(nzt NE jpk)] |
---|
[2] | 101 | mask = temporary(mask[*])#replicate(1, jpt) |
---|
| 102 | mask = reform(mask, nxv, nyv, jpt, /over) |
---|
[13] | 103 | ENDIF ELSE mask = (vmask())[firstxv:lastxv, firstyv:lastyv, firstzt:lastzt] |
---|
[231] | 104 | terre = where(temporary(mask) EQ 0) |
---|
[2] | 105 | IF terre[0] NE -1 THEN res[temporary(terre)] = !values.f_nan |
---|
| 106 | res = 0.5*(res + shift(res, 0, +1, 0)) |
---|
| 107 | res[*, 0, *] = !values.f_nan |
---|
| 108 | if taille[3] EQ jpt then BEGIN |
---|
[13] | 109 | mask = tmask[firstxv:lastxv, firstyv:lastyv, lastzt*(nzt NE jpk)] |
---|
[2] | 110 | mask = temporary(mask[*])#replicate(1, jpt) |
---|
| 111 | mask = reform(mask, nxv, nyv, jpt, /over) |
---|
[13] | 112 | ENDIF ELSE mask = tmask[firstxv:lastxv, firstyv:lastyv, firstzt:lastzt] |
---|
[231] | 113 | terre = where(temporary(mask) EQ 0) |
---|
[2] | 114 | IF terre[0] NE -1 THEN res[temporary(terre)] = valmask |
---|
| 115 | END |
---|
[231] | 116 | 4: BEGIN |
---|
[2] | 117 | case 1 of |
---|
| 118 | taille[1] eq nxv and taille[2] eq nyv AND taille[3] EQ nzt AND taille[4] EQ jpt: |
---|
| 119 | taille[1] eq nxv and taille[2] eq nyv AND taille[3] EQ jpk AND taille[4] EQ jpt: $ |
---|
[13] | 120 | res=res[*, *, firstzt:lastzt, *] |
---|
[2] | 121 | taille[1] eq jpi and taille[2] eq jpj AND taille[3] EQ jpk AND taille[4] EQ jpt: $ |
---|
[13] | 122 | res=res[firstxv:lastxv, firstyv:lastyv, firstzt:lastzt, *] |
---|
[2] | 123 | else: $ |
---|
| 124 | return, report('Probleme d''adequation entre les tailles du domaine et de la boite.') |
---|
| 125 | ENDCASE |
---|
[13] | 126 | mask = (vmask())[firstxv:lastxv, firstyv:lastyv, firstzt:lastzt] |
---|
[2] | 127 | mask = temporary(mask[*])#replicate(1, jpt) |
---|
| 128 | mask = reform(mask, nxv, nyv, nzt, jpt, /over) |
---|
[231] | 129 | terre = where(temporary(mask) EQ 0) |
---|
[2] | 130 | IF terre[0] NE -1 THEN res[temporary(terre)] = !values.f_nan |
---|
| 131 | res = 0.5*(res + shift(res, 0, +1, 0, 0)) |
---|
| 132 | res[*, 0, *, *] = !values.f_nan |
---|
[13] | 133 | mask = tmask[firstxv:lastxv, firstyv:lastyv, firstzt:lastzt] |
---|
[2] | 134 | mask = temporary(mask[*])#replicate(1, jpt) |
---|
| 135 | mask = reform(mask, nxv, nyv, nzt, jpt, /over) |
---|
[231] | 136 | terre = where(temporary(mask) EQ 0) |
---|
[2] | 137 | IF terre[0] NE -1 THEN res[temporary(terre)] = valmask |
---|
| 138 | END |
---|
| 139 | endcase |
---|
| 140 | |
---|
[13] | 141 | IF NOT keyword_set(key_forgetold) THEN BEGIN |
---|
| 142 | @updateold |
---|
[231] | 143 | ENDIF |
---|
[13] | 144 | |
---|
| 145 | return, res |
---|
[2] | 146 | END |
---|