[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} |
---|
[268] | 11 | ; A 2d, 3d or 4d array |
---|
[2] | 12 | ; |
---|
[142] | 13 | ; @returns |
---|
[268] | 14 | ; a 2d, 3d 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 | ;- |
---|
| 36 | FUNCTION t2v, temp |
---|
[114] | 37 | ; |
---|
| 38 | compile_opt idl2, strictarrsubs |
---|
| 39 | ; |
---|
[13] | 40 | @cm_4mesh |
---|
| 41 | @cm_4data |
---|
| 42 | @cm_4cal |
---|
| 43 | IF NOT keyword_set(key_forgetold) THEN BEGIN |
---|
| 44 | @updatenew |
---|
| 45 | ENDIF |
---|
| 46 | ;--------------------------------------------------------- |
---|
[2] | 47 | res = temp |
---|
| 48 | |
---|
[142] | 49 | ;We force nxt=nxv, etc ... |
---|
[13] | 50 | firstxv = firstxt |
---|
| 51 | lastxv = lastxt |
---|
| 52 | firstyv = firstyt |
---|
| 53 | lastyv = lastyt |
---|
[2] | 54 | nxv = nxt |
---|
| 55 | nyv = nyt |
---|
| 56 | vargrid = 'V' |
---|
| 57 | if NOT keyword_set(valmask) then valmask = 1e20 |
---|
[13] | 58 | lat1 = gphit[0, firstyt] |
---|
| 59 | lat2 = gphiv[0, lastyv] |
---|
[2] | 60 | |
---|
[142] | 61 | ; case on tha array's size and application |
---|
[2] | 62 | taille = size(temp) |
---|
| 63 | CASE taille[0] OF |
---|
| 64 | 1: res = -1 |
---|
| 65 | 2: BEGIN |
---|
| 66 | case 1 of |
---|
| 67 | taille[1] eq nxt and taille[2] eq nyt: |
---|
| 68 | taille[1] eq jpi and taille[2] eq jpj: $ |
---|
[13] | 69 | res=res[firstxt:lastxt, firstyt:lastyt] |
---|
[2] | 70 | else: $ |
---|
| 71 | return, report('Probleme d''adequation entre les tailles du domaine et de la boite.') |
---|
| 72 | endcase |
---|
[13] | 73 | mask = tmask[firstxt:lastxt, firstyt:lastyt, 0] |
---|
[2] | 74 | terre = where(mask EQ 0) |
---|
| 75 | IF terre[0] NE -1 THEN res[terre] = !values.f_nan |
---|
| 76 | res = 0.5*(res + shift(res, 0, -1)) |
---|
| 77 | res[*, nyt-1] = !values.f_nan |
---|
[13] | 78 | mask = (vmask())[firstxt:lastxt, firstyt:lastyt, 0] |
---|
[2] | 79 | terre = where(mask EQ 0) |
---|
| 80 | IF terre[0] NE -1 THEN res[terre] = valmask |
---|
| 81 | END |
---|
| 82 | 3: BEGIN |
---|
| 83 | case 1 of |
---|
| 84 | taille[1] eq nxt and taille[2] eq nyt AND taille[3] EQ nzt: |
---|
| 85 | taille[1] eq nxt and taille[2] eq nyt AND taille[3] EQ jpk: $ |
---|
[13] | 86 | res=res[*, *, firstzt:lastzt] |
---|
[2] | 87 | taille[1] eq nxt and taille[2] eq nyt AND taille[3] EQ jpt: |
---|
| 88 | taille[1] eq jpi and taille[2] eq jpj AND taille[3] EQ jpk: $ |
---|
[13] | 89 | res=res[firstxt:lastxt, firstyt:lastyt, firstzt:lastzt] |
---|
[2] | 90 | taille[1] eq jpi and taille[2] eq jpj AND taille[3] EQ jpt: $ |
---|
[13] | 91 | res=res[firstxt:lastxt, firstyt:lastyt, *] |
---|
[2] | 92 | else: $ |
---|
| 93 | return, report('Probleme d''adequation entre les tailles du domaine et de la boite.') |
---|
| 94 | ENDCASE |
---|
| 95 | if taille[3] EQ jpt then begin |
---|
[13] | 96 | mask = tmask[firstxt:lastxt, firstyt:lastyt, lastzt*(nzt NE jpk)] |
---|
[2] | 97 | mask = temporary(mask[*])#replicate(1, jpt) |
---|
| 98 | mask = reform(mask, nxt, nyt, jpt, /over) |
---|
[13] | 99 | ENDIF ELSE mask = tmask[firstxt:lastxt, firstyt:lastyt, firstzt:lastzt] |
---|
[2] | 100 | terre = where(temporary(mask) EQ 0) |
---|
| 101 | IF terre[0] NE -1 THEN res[temporary(terre)] = !values.f_nan |
---|
| 102 | res = 0.5*(res + shift(res, 0, -1, 0)) |
---|
| 103 | res[*, nyt-1, *] = !values.f_nan |
---|
| 104 | if taille[3] EQ jpt then BEGIN |
---|
[13] | 105 | mask = (vmask())[firstxt:lastxt, firstyt:lastyt, lastzt*(nzt NE jpk)] |
---|
[2] | 106 | mask = temporary(mask[*])#replicate(1, jpt) |
---|
| 107 | mask = reform(mask, nxt, nyt, jpt, /over) |
---|
[13] | 108 | ENDIF ELSE mask = (vmask())[firstxt:lastxt, firstyt:lastyt, firstzt:lastzt] |
---|
[2] | 109 | terre = where(temporary(mask) EQ 0) |
---|
| 110 | IF terre[0] NE -1 THEN res[temporary(terre)] = valmask |
---|
| 111 | END |
---|
| 112 | 4: BEGIN |
---|
| 113 | case 1 of |
---|
| 114 | taille[1] eq nxt and taille[2] eq nyt AND taille[3] EQ nzt AND taille[4] EQ jpt: |
---|
| 115 | taille[1] eq nxt and taille[2] eq nyt AND taille[3] EQ jpk AND taille[4] EQ jpt: $ |
---|
[13] | 116 | res=res[*, *, firstzt:lastzt, *] |
---|
[2] | 117 | taille[1] eq jpi and taille[2] eq jpj AND taille[3] EQ jpk AND taille[4] EQ jpt: $ |
---|
[13] | 118 | res=res[firstxt:lastxt, firstyt:lastyt, firstzt:lastzt, *] |
---|
[2] | 119 | else: $ |
---|
| 120 | return, report('Probleme d''adequation entre les tailles du domaine et de la boite.') |
---|
| 121 | ENDCASE |
---|
[13] | 122 | mask = tmask[firstxt:lastxt, firstyt:lastyt, firstzt:lastzt] |
---|
[2] | 123 | mask = temporary(mask[*])#replicate(1, jpt) |
---|
| 124 | mask = reform(mask, nxt, nyt, nzt, jpt, /over) |
---|
| 125 | terre = where(temporary(mask) EQ 0) |
---|
| 126 | IF terre[0] NE -1 THEN res[temporary(terre)] = !values.f_nan |
---|
| 127 | res = 0.5*(res + shift(res, 0, -1, 0, 0)) |
---|
| 128 | res[*, nyt-1, *, *] = !values.f_nan |
---|
[13] | 129 | mask = (vmask())[firstxt:lastxt, firstyt:lastyt, firstzt:lastzt] |
---|
[2] | 130 | mask = temporary(mask[*])#replicate(1, jpt) |
---|
| 131 | mask = reform(mask, nxt, nyt, nzt, jpt, /over) |
---|
| 132 | terre = where(temporary(mask) EQ 0) |
---|
| 133 | IF terre[0] NE -1 THEN res[temporary(terre)] = valmask |
---|
| 134 | END |
---|
[13] | 135 | ENDCASE |
---|
[2] | 136 | |
---|
[13] | 137 | IF NOT keyword_set(key_forgetold) THEN BEGIN |
---|
| 138 | @updateold |
---|
| 139 | ENDIF |
---|
| 140 | |
---|
[2] | 141 | return, res |
---|
| 142 | END |
---|