[2] | 1 | ;+ |
---|
| 2 | ; |
---|
[142] | 3 | ; @file_comments |
---|
[231] | 4 | ; Allows to pass a field referring to the grid U 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 | ; |
---|
| 36 | ;- |
---|
[231] | 37 | ; |
---|
[2] | 38 | FUNCTION u2t, temp |
---|
[114] | 39 | ; |
---|
| 40 | compile_opt idl2, strictarrsubs |
---|
| 41 | ; |
---|
[13] | 42 | @cm_4mesh |
---|
| 43 | @cm_4data |
---|
| 44 | @cm_4cal |
---|
| 45 | IF NOT keyword_set(key_forgetold) THEN BEGIN |
---|
| 46 | @updatenew |
---|
| 47 | ENDIF |
---|
| 48 | ;--------------------------------------------------------- |
---|
[2] | 49 | res = temp |
---|
| 50 | ;on force nxt=nxu, etc ... |
---|
[13] | 51 | firstxt = firstxu |
---|
| 52 | lastxt = lastxu |
---|
| 53 | firstyt = firstyu |
---|
| 54 | lastyt = lastyu |
---|
[2] | 55 | nxt = nxu |
---|
| 56 | nyt = nyu |
---|
| 57 | vargrid = 'T' |
---|
| 58 | if NOT keyword_set(valmask) then valmask = 1e20 |
---|
[13] | 59 | lon1 = glamt[firstxt, 0] |
---|
| 60 | lon2 = glamu[lastxu, 0] |
---|
[2] | 61 | ; |
---|
[142] | 62 | ; case on tha array's size and application |
---|
[2] | 63 | taille = size(temp) |
---|
[231] | 64 | CASE taille[0] OF |
---|
[2] | 65 | 1: res = -1 |
---|
[231] | 66 | 2: BEGIN |
---|
[2] | 67 | case 1 of |
---|
| 68 | taille[1] eq nxu and taille[2] eq nyu: |
---|
| 69 | taille[1] eq jpi and taille[2] eq jpj: $ |
---|
[13] | 70 | res=res[firstxu:lastxu, firstyu:lastyu] |
---|
[2] | 71 | else: $ |
---|
| 72 | return, report('Probleme d''adequation entre les tailles du domaine et de la boite.') |
---|
| 73 | endcase |
---|
[13] | 74 | mask = (umask())[firstxu:lastxu, firstyu:lastyu, 0] |
---|
[231] | 75 | terre = where(mask EQ 0) |
---|
[2] | 76 | IF terre[0] NE -1 THEN res[terre] = !values.f_nan |
---|
| 77 | res = 0.5*(res + shift(res, 1, 0)) |
---|
[13] | 78 | if NOT (keyword_set(key_periodic) AND nxu EQ jpi) then res[0, *] = !values.f_nan |
---|
| 79 | mask = tmask[firstxu:lastxu, firstyu:lastyu, 0] |
---|
[231] | 80 | terre = where(mask EQ 0) |
---|
[2] | 81 | IF terre[0] NE -1 THEN res[terre] = valmask |
---|
| 82 | END |
---|
[231] | 83 | 3: BEGIN |
---|
[2] | 84 | case 1 of |
---|
| 85 | taille[1] eq nxu and taille[2] eq nyu AND taille[3] EQ nzt: |
---|
| 86 | taille[1] eq nxu and taille[2] eq nyu AND taille[3] EQ jpk: $ |
---|
[13] | 87 | res=res[*, *, firstzt:lastzt] |
---|
[2] | 88 | taille[1] eq nxu and taille[2] eq nyu AND taille[3] EQ jpt: |
---|
| 89 | taille[1] eq jpi and taille[2] eq jpj AND taille[3] EQ jpk: $ |
---|
[13] | 90 | res=res[firstxu:lastxu, firstyu:lastyu, firstzt:lastzt] |
---|
[2] | 91 | taille[1] eq jpi and taille[2] eq jpj AND taille[3] EQ jpt: $ |
---|
[13] | 92 | res=res[firstxu:lastxu, firstyu:lastyu, *] |
---|
[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 = (umask())[firstxu:lastxu, firstyu:lastyu, lastzt*(nzt NE jpk)] |
---|
[2] | 98 | mask = temporary(mask[*])#replicate(1, jpt) |
---|
| 99 | mask = reform(mask, nxu, nyu, jpt, /over) |
---|
[13] | 100 | ENDIF ELSE mask = (umask())[firstxu:lastxu, firstyu:lastyu, firstzt:lastzt] |
---|
[231] | 101 | terre = where(temporary(mask) EQ 0) |
---|
[2] | 102 | IF terre[0] NE -1 THEN res[temporary(terre)] = !values.f_nan |
---|
| 103 | res = 0.5*(res + shift(res, 1, 0, 0)) |
---|
[13] | 104 | if NOT (keyword_set(key_periodic) AND nxu EQ jpi) then res[0, *, *] = !values.f_nan |
---|
[2] | 105 | if taille[3] EQ jpt then BEGIN |
---|
[13] | 106 | mask = tmask[firstxu:lastxu, firstyu:lastyu, lastzt*(nzt NE jpk)] |
---|
[2] | 107 | mask = temporary(mask[*])#replicate(1, jpt) |
---|
| 108 | mask = reform(mask, nxu, nyu, jpt, /over) |
---|
[13] | 109 | ENDIF ELSE mask = tmask[firstxu:lastxu, firstyu:lastyu, firstzt:lastzt] |
---|
[231] | 110 | terre = where(temporary(mask) EQ 0) |
---|
[2] | 111 | IF terre[0] NE -1 THEN res[temporary(terre)] = valmask |
---|
| 112 | END |
---|
[231] | 113 | 4: BEGIN |
---|
[2] | 114 | case 1 of |
---|
| 115 | taille[1] eq nxu and taille[2] eq nyu AND taille[3] EQ nzt AND taille[4] EQ jpt: |
---|
| 116 | taille[1] eq nxu and taille[2] eq nyu 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[firstxu:lastxu, firstyu:lastyu, 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 = (umask())[firstxu:lastxu, firstyu:lastyu, firstzt:lastzt] |
---|
[2] | 124 | mask = temporary(mask[*])#replicate(1, jpt) |
---|
| 125 | mask = reform(mask, nxu, nyu, nzt, jpt, /over) |
---|
[231] | 126 | terre = where(temporary(mask) EQ 0) |
---|
[2] | 127 | IF terre[0] NE -1 THEN res[temporary(terre)] = !values.f_nan |
---|
| 128 | res = 0.5*(res + shift(res, 1, 0, 0, 0)) |
---|
[13] | 129 | if NOT (keyword_set(key_periodic) AND nxu EQ jpi) then res[0, *, *, *] = !values.f_nan |
---|
| 130 | mask = tmask[firstxu:lastxu, firstyu:lastyu, firstzt:lastzt] |
---|
[2] | 131 | mask = temporary(mask[*])#replicate(1, jpt) |
---|
| 132 | mask = reform(mask, nxu, nyu, nzt, jpt, /over) |
---|
[231] | 133 | terre = where(temporary(mask) EQ 0) |
---|
[2] | 134 | IF terre[0] NE -1 THEN res[temporary(terre)] = valmask |
---|
| 135 | END |
---|
| 136 | endcase |
---|
| 137 | |
---|
[13] | 138 | IF NOT keyword_set(key_forgetold) THEN BEGIN |
---|
| 139 | @updateold |
---|
[231] | 140 | ENDIF |
---|
| 141 | |
---|
[2] | 142 | return, res |
---|
| 143 | END |
---|