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