[157] | 1 | ;+ |
---|
| 2 | ; |
---|
| 3 | ; @file_comments |
---|
| 4 | ; |
---|
| 5 | ; @categories |
---|
| 6 | ; Graphics |
---|
| 7 | ; |
---|
[231] | 8 | ; @param LONS |
---|
[157] | 9 | ; |
---|
| 10 | ; @param LATS |
---|
| 11 | ; |
---|
| 12 | ; @param SEUIL |
---|
| 13 | ; |
---|
| 14 | ; @keyword _EXTRA |
---|
[231] | 15 | ; Used to pass keywords |
---|
[157] | 16 | ; |
---|
[163] | 17 | ; @keyword CONT_COLOR {default=(!d.n_colors - 1) < 255 => white} |
---|
| 18 | ; The color of the continent. |
---|
[157] | 19 | ; |
---|
| 20 | ; @uses |
---|
[370] | 21 | ; <pro>common</pro> |
---|
[157] | 22 | ; |
---|
| 23 | ; @history |
---|
| 24 | ; Sebastien Masson (smasson\@lodyc.jussieu.fr) |
---|
| 25 | ; 01/10/1999 |
---|
| 26 | ; |
---|
| 27 | ; @version |
---|
| 28 | ; $Id$ |
---|
| 29 | ; |
---|
| 30 | ;- |
---|
[327] | 31 | PRO draw_corner_triangle, lons, lats, seuil, CONT_COLOR=cont_color, _EXTRA=ex |
---|
[114] | 32 | ; |
---|
| 33 | compile_opt idl2, strictarrsubs |
---|
| 34 | ; |
---|
[29] | 35 | @cm_4mesh |
---|
| 36 | ; the triangle must not be out of the domain |
---|
| 37 | IF min(lons, max = maxlon) GE lon1 AND maxlon LE lon2 $ |
---|
| 38 | AND min(lats, max = maxlat) GE lat1 AND maxlat LE lat2 then BEGIN |
---|
[231] | 39 | ; the triangle must not be too big |
---|
| 40 | z = convert_coord(lons, lats, /data, /to_normal) |
---|
[29] | 41 | alldist = [(z[0, 2]-z[0, 0])^2 + (z[1, 2]-z[1, 0])^2 $ |
---|
| 42 | , (z[0, 0]-z[0, 1])^2 + (z[1, 0]-z[1, 1])^2 $ |
---|
| 43 | , (z[0, 1]-z[0, 2])^2 + (z[1, 1]-z[1, 2])^2] |
---|
| 44 | IF max(alldist) LT seuil^2 THEN polyfill, lons, lats $ |
---|
| 45 | , color = cont_color, _extra = ex |
---|
| 46 | return |
---|
[231] | 47 | ENDIF |
---|
[29] | 48 | end |
---|
[232] | 49 | ; |
---|
[150] | 50 | ;+ |
---|
| 51 | ; |
---|
| 52 | ; @file_comments |
---|
| 53 | ; To color cleanly continents |
---|
| 54 | ; |
---|
| 55 | ; @categories |
---|
[157] | 56 | ; Graphics |
---|
[150] | 57 | ; |
---|
| 58 | ; @keyword _EXTRA |
---|
[231] | 59 | ; Used to pass keywords |
---|
[150] | 60 | ; |
---|
| 61 | ; @keyword CONT_COLOR |
---|
[163] | 62 | ; The color of the continent. default value is |
---|
[150] | 63 | ; (!d.n_colors - 1) < 255 => white |
---|
| 64 | ; |
---|
[163] | 65 | ; @keyword COINMONTE {type=array} |
---|
[231] | 66 | ; To obtain the array of "ascending land corner" |
---|
| 67 | ; to be treated with <pro>completecointerre</pro> in the variable array |
---|
[157] | 68 | ; instead of make it pass by the global variable twin_corners_up. |
---|
| 69 | ; |
---|
[163] | 70 | ; @keyword COINDESCEND {type=array} |
---|
| 71 | ; See COINMONTE |
---|
[157] | 72 | ; |
---|
| 73 | ; @keyword INDICEZOOM |
---|
| 74 | ; The zoom's index |
---|
| 75 | ; |
---|
[150] | 76 | ; @uses |
---|
[370] | 77 | ; <pro>common</pro> |
---|
[150] | 78 | ; |
---|
| 79 | ; @history |
---|
[157] | 80 | ; Sebastien Masson (smasson\@lodyc.jussieu.fr) |
---|
[150] | 81 | ; 01/10/1999 |
---|
| 82 | ; |
---|
| 83 | ; @version |
---|
| 84 | ; $Id$ |
---|
| 85 | ; |
---|
| 86 | ;- |
---|
[327] | 87 | PRO completecointerre, COINMONTE=coinmonte, COINDESCEND=coindescend $ |
---|
| 88 | , CONT_COLOR=cont_color, INDICEZOOM=indicezoom $ |
---|
| 89 | , _EXTRA=ex |
---|
[114] | 90 | ; |
---|
| 91 | compile_opt idl2, strictarrsubs |
---|
| 92 | ; |
---|
[2] | 93 | @common |
---|
| 94 | ;------------------------------------------------------------ |
---|
[29] | 95 | ; if NOT keyword_set(coinmonte) then return |
---|
| 96 | ; if NOT keyword_set(coindescend) then return |
---|
| 97 | ; if NOT keyword_set(indicezoom) then return |
---|
[150] | 98 | tempsun = systime(1) ; For key_performance |
---|
[2] | 99 | ;------------------------------------------------------------ |
---|
[150] | 100 | ; definitions of vectors coinmont and coindesc |
---|
[2] | 101 | ;------------------------------------------------------------ |
---|
[29] | 102 | if keyword_set(coinmonte) then coinmont = coinmonte $ |
---|
| 103 | ELSE coinmont = twin_corners_up |
---|
| 104 | if keyword_set(coindescend) then coindesc = coindescend $ |
---|
| 105 | ELSE coindesc = twin_corners_dn |
---|
| 106 | IF NOT keyword_set(cont_color) THEN cont_color = (!d.n_colors-1) < 255 |
---|
[2] | 107 | ;------------------------------------------------------------ |
---|
[150] | 108 | ; definition of coordinates of points numbered 1,2,3,4,5,6 (see figures below) |
---|
[2] | 109 | ;------------------------------------------------------------ |
---|
[150] | 110 | tempdeux = systime(1) ; For key_performance =2 |
---|
[29] | 111 | if coinmont[0] NE -1 OR coindesc[0] NE -1 then BEGIN |
---|
| 112 | if keyword_set(indicezoom) then BEGIN |
---|
| 113 | ; if we use key_stide, the t, u, v and f points are no more related to |
---|
| 114 | ; the same cell because glamf and gphif has be recomputed to be in the |
---|
| 115 | ; middle of two t points |
---|
| 116 | IF total(key_stride) EQ 3 AND finite(glamv[0]*gphiv[0]) NE 0 THEN BEGIN |
---|
| 117 | long1 = glamv[indicezoom] & lati1 = gphiv[indicezoom] |
---|
[231] | 118 | ENDIF ELSE BEGIN |
---|
[29] | 119 | long1 = glamt[indicezoom] & lati1 = gphif[indicezoom] |
---|
| 120 | ENDELSE |
---|
| 121 | IF total(key_stride) EQ 3 AND finite(glamu[0]*gphiu[0]) NE 0 THEN BEGIN |
---|
| 122 | long2 = glamu[indicezoom] & lati2 = gphiu[indicezoom] |
---|
| 123 | ENDIF ELSE BEGIN |
---|
| 124 | long2 = glamf[indicezoom] & lati2 = gphit[indicezoom] |
---|
| 125 | ENDELSE |
---|
| 126 | long3 = glamf[indicezoom] & lati3 = gphif[indicezoom] |
---|
[231] | 127 | ENDIF ELSE BEGIN |
---|
[29] | 128 | IF total(key_stride) EQ 3 AND finite(glamv[0]*gphiv[0]) NE 0 THEN BEGIN |
---|
| 129 | long1 = glamv & lati1 = gphiv |
---|
[231] | 130 | ENDIF ELSE BEGIN |
---|
[29] | 131 | long1 = glamt & lati1 = gphif |
---|
| 132 | ENDELSE |
---|
| 133 | IF total(key_stride) EQ 3 AND finite(glamu[0]*gphiu[0]) NE 0 THEN BEGIN |
---|
| 134 | long2 = glamu & lati2 = gphiu |
---|
[231] | 135 | ENDIF ELSE BEGIN |
---|
[29] | 136 | long2 = glamf & lati2 = gphit |
---|
| 137 | ENDELSE |
---|
| 138 | long3 = glamf & lati3 = gphif |
---|
[231] | 139 | ENDELSE |
---|
[29] | 140 | ; |
---|
| 141 | nx = (size(long1, /dimensions))[0] |
---|
| 142 | ny = (size(long1, /dimensions))[1] |
---|
| 143 | seuil = 5 < (min([nx, ny])-2) |
---|
| 144 | seuil = min([(!p.position[2]-!p.position[0])/seuil $ |
---|
| 145 | , (!p.position[3]-!p.position[1])/seuil]) |
---|
| 146 | ; |
---|
| 147 | ENDIF |
---|
| 148 | ; |
---|
| 149 | IF testvar(var = key_performance) EQ 2 THEN $ |
---|
[2] | 150 | print, 'temps completecointerre: positions des points', systime(1)-tempdeux |
---|
| 151 | ; |
---|
| 152 | ; |
---|
[150] | 153 | ; Case land corner in ascent: |
---|
| 154 | ; 2 land points in diagonal ascending with 2 ocean points on the descendant diagonal. |
---|
[2] | 155 | ; |
---|
[231] | 156 | ; 4 |
---|
[2] | 157 | ; t(i+nx)=1 u(i+nx) t(i+nx+1)=0 |
---|
[29] | 158 | ; | \ |
---|
| 159 | ; | \ |
---|
[2] | 160 | ; 1 3 | \ 5 |
---|
| 161 | ; v(i)---------f(i)------------v(i+1) |
---|
| 162 | ; \ | |
---|
| 163 | ; \ | |
---|
| 164 | ; \ | |
---|
| 165 | ; t(i)=0 2 u(i) t(i+1)=1 |
---|
| 166 | ; |
---|
| 167 | ; |
---|
[29] | 168 | if coinmont[0] NE -1 then BEGIN |
---|
[150] | 169 | tempdeux = systime(1) ; For key_performance =2 |
---|
[29] | 170 | for id = 0, n_elements(coinmont)-1 do BEGIN |
---|
| 171 | i = coinmont[id] |
---|
| 172 | ii = i MOD nx |
---|
| 173 | ij = i/nx |
---|
| 174 | ; bottom triangle |
---|
| 175 | lons = [long1[i], long2[i], long3[i]] |
---|
| 176 | lats = [lati1[i], lati2[i], lati3[i]] |
---|
| 177 | draw_corner_triangle, lons, lats, seuil, CONT_COLOR = cont_color, _extra = ex |
---|
| 178 | ; upper triangle |
---|
| 179 | IF ii NE nx-1 AND ij NE ny-1 THEN BEGIN |
---|
| 180 | lons = [long3[i], long1[i+1], long2[i+nx]] |
---|
| 181 | lats = [lati3[i], lati1[i+1], lati2[i+nx]] |
---|
| 182 | draw_corner_triangle, lons, lats, seuil, CONT_COLOR = cont_color, _extra = ex |
---|
[231] | 183 | ENDIF |
---|
| 184 | ENDFOR |
---|
[29] | 185 | IF testvar(var = key_performance) EQ 2 THEN $ |
---|
| 186 | print, 'temps completecointerre: trace de cointerremonte', systime(1)-tempdeux |
---|
| 187 | ENDIF |
---|
[2] | 188 | ;------------------------------------------------------------ |
---|
[150] | 189 | ; Case land corner in descent: |
---|
| 190 | ; 2 land points in diagonal descending with 2 ocean points on the ascendant diagonal. |
---|
[231] | 191 | ; |
---|
[2] | 192 | ; 4 |
---|
| 193 | ; t(i+nx)=1 u(i+nx) t(i+nx+1)=0 |
---|
[231] | 194 | ; / | |
---|
| 195 | ; / | |
---|
[2] | 196 | ; / 3 | 5 |
---|
| 197 | ; v(i)---------f(i)------------v(i+1) |
---|
| 198 | ; 1 | / |
---|
| 199 | ; | / |
---|
| 200 | ; | / |
---|
| 201 | ; t(i)=0 2 u(i) t(i+1)=1 |
---|
| 202 | ; |
---|
[29] | 203 | if coindesc[0] NE -1 then begin |
---|
[150] | 204 | tempdeux = systime(1) ; For key_performance =2 |
---|
[29] | 205 | for id = 0, n_elements(coindesc)-1 do BEGIN |
---|
| 206 | i = coindesc[id] |
---|
| 207 | ii = i MOD nx |
---|
| 208 | ij = i/nx |
---|
| 209 | IF ii NE nx-1 AND ij NE ny-1 THEN BEGIN |
---|
| 210 | ; left triangle |
---|
| 211 | lons = [long1[i], long3[i], long2[i+nx]] |
---|
| 212 | lats = [lati1[i], lati3[i], lati2[i+nx]] |
---|
| 213 | draw_corner_triangle, lons, lats, seuil, CONT_COLOR = cont_color, _extra = ex |
---|
| 214 | ; right triangle |
---|
| 215 | lons = [long3[i], long2[i], long1[i+1]] |
---|
| 216 | lats = [lati3[i], lati2[i], lati1[i+1]] |
---|
| 217 | draw_corner_triangle, lons, lats, seuil, CONT_COLOR = cont_color, _extra = ex |
---|
| 218 | ENDIF |
---|
| 219 | ENDFOR |
---|
| 220 | IF testvar(var = key_performance) EQ 2 THEN $ |
---|
| 221 | print, 'temps completecointerre: trace de cointerredescend', systime(1)-tempdeux |
---|
| 222 | ENDIF |
---|
[2] | 223 | |
---|
| 224 | ;------------------------------------------------------------ |
---|
[231] | 225 | IF keyword_set(key_performance) THEN print, 'temps completecointerre', systime(1)-tempsun |
---|
[2] | 226 | ;------------------------------------------------------------ |
---|
[29] | 227 | return |
---|
[2] | 228 | end |
---|