[14] | 1 | ;------------------------------------------------------------ |
---|
| 2 | ;------------------------------------------------------------ |
---|
| 3 | ;------------------------------------------------------------ |
---|
| 4 | ;+ |
---|
| 5 | ; |
---|
[142] | 6 | ; @file_comments |
---|
| 7 | ; Similar to grille. Here, when vargrid is not 'T' or 'W', we have to |
---|
| 8 | ; recuperate Tmask, glamt, gphit and the array of triangulation on the |
---|
[163] | 9 | ; considered sub-domain for the drawing. The specificity of decoupeterre |
---|
| 10 | ; in comparaison with grille, is that we take, if possible, a sub-domain |
---|
[142] | 11 | ; just a little bit bigger than the one defined by domdef in order to be |
---|
| 12 | ; sure that the mask we draw will cover over all the drawing. |
---|
[14] | 13 | ; |
---|
[142] | 14 | ; @categories |
---|
[157] | 15 | ; Utilities |
---|
[14] | 16 | ; |
---|
[163] | 17 | ; @param MASK |
---|
| 18 | ; |
---|
| 19 | ; |
---|
| 20 | ; @param GLAM |
---|
| 21 | ; |
---|
| 22 | ; |
---|
| 23 | ; @param GPHI |
---|
| 24 | ; |
---|
| 25 | ; |
---|
| 26 | ; @param GDEP |
---|
| 27 | ; |
---|
| 28 | ; |
---|
| 29 | ; @keyword TYPE |
---|
| 30 | ; |
---|
| 31 | ; |
---|
| 32 | ; @keyword INDICEZOOM |
---|
| 33 | ; |
---|
| 34 | ; |
---|
| 35 | ; @keyword COINMONTE |
---|
| 36 | ; |
---|
| 37 | ; |
---|
| 38 | ; @keyword COINDESCEND |
---|
| 39 | ; |
---|
| 40 | ; |
---|
| 41 | ; @keyword REALSECTION |
---|
| 42 | ; |
---|
| 43 | ; |
---|
| 44 | ; @keyword USETRI |
---|
| 45 | ; |
---|
| 46 | ; |
---|
| 47 | ; @keyword _EXTRA |
---|
| 48 | ; Used to pass your keywords |
---|
| 49 | ; |
---|
[226] | 50 | ; @keyword TRI |
---|
[142] | 51 | ; This keyword serve to obtain, thanks to grille, the triangulation which |
---|
| 52 | ; refer to the grid but only on the part of the zoom. This of triangulation |
---|
| 53 | ; is passed in the variable we have equate at TRI. |
---|
| 54 | ; For example: grille,...,tri=triangulation_reduite. |
---|
| 55 | ; This keyword is used in plt.pro |
---|
[14] | 56 | ; |
---|
[142] | 57 | ; @keyword WDEPTH |
---|
[226] | 58 | ; To specify that the field is at W depth instead of T |
---|
[142] | 59 | ; depth (automatically activated if vargrid eq 'W') |
---|
[14] | 60 | ; |
---|
[142] | 61 | ; @uses |
---|
| 62 | ; common.pro |
---|
[14] | 63 | ; |
---|
[142] | 64 | ; @history |
---|
[157] | 65 | ; Sebastien Masson (smasson\@lodyc.jussieu.fr) |
---|
[142] | 66 | ; 24/2/99 |
---|
[14] | 67 | ; |
---|
[142] | 68 | ; @version |
---|
| 69 | ; $Id$ |
---|
[14] | 70 | ; |
---|
[142] | 71 | ; @todo seb : manque tous les param et plein de keywords. |
---|
[14] | 72 | ; |
---|
| 73 | ; |
---|
| 74 | ; |
---|
| 75 | ; |
---|
| 76 | ;- |
---|
| 77 | ;------------------------------------------------------------ |
---|
| 78 | ;------------------------------------------------------------ |
---|
| 79 | ;------------------------------------------------------------ |
---|
| 80 | PRO decoupeterre, mask, glam, gphi, gdep, TYPE = type, TRI = tri, INDICEZOOM = indicezoom, COINMONTE = coinmonte, COINDESCEND = coindescend, WDEPTH = wdepth, REALSECTION = realsection, USETRI = usetri, _extra = ex |
---|
| 81 | ;--------------------------------------------------------- |
---|
[114] | 82 | ; |
---|
| 83 | compile_opt idl2, strictarrsubs |
---|
| 84 | ; |
---|
[14] | 85 | @cm_4mesh |
---|
| 86 | @cm_4data |
---|
| 87 | IF NOT keyword_set(key_forgetold) THEN BEGIN |
---|
| 88 | @updatenew |
---|
| 89 | ENDIF |
---|
| 90 | ;--------------------------------------------------------- |
---|
[142] | 91 | tempsun = systime(1) ; For key_performance |
---|
[14] | 92 | ;------------------------------------------------------------ |
---|
| 93 | if vargrid EQ 'W' then wdepth = 1 |
---|
| 94 | ;------------------------------------------------------------ |
---|
| 95 | ;------------------------------------------------------------ |
---|
| 96 | ; horizontal parameters |
---|
| 97 | ;------------------------------------------------------------ |
---|
| 98 | ; if possible extent the domain according to the grid type |
---|
| 99 | ; default case |
---|
| 100 | case vargrid of |
---|
| 101 | 'U':BEGIN |
---|
| 102 | firstx = 0 > (min([firstxt, firstxu])-1) |
---|
| 103 | lastx = (max([lastxt, lastxu])+1) < (jpi-1) |
---|
| 104 | firsty = 0 > (min([firstyt, firstyu])-1) |
---|
| 105 | lasty = (max([lastyt, lastyu])+1) < (jpj-1) |
---|
| 106 | end |
---|
| 107 | 'V':BEGIN |
---|
| 108 | firstx = 0 > (min([firstxt, firstxv])-1) |
---|
| 109 | lastx = (max([lastxt, lastxv])+1) < (jpi-1) |
---|
| 110 | firsty = 0 > (min([firstyt, firstyv])-1) |
---|
| 111 | lasty = (max([lastyt, lastyv])+1) < (jpj-1) |
---|
| 112 | end |
---|
| 113 | 'F':BEGIN |
---|
| 114 | firstx = 0 > (min([firstxt, firstxf])-1) |
---|
| 115 | lastx = (max([lastxt, lastxf])+1) < (jpi-1) |
---|
| 116 | firsty = 0 > (min([firstyt, firstyf])-1) |
---|
| 117 | lasty = (max([lastyt, lastyf])+1) < (jpj-1) |
---|
| 118 | END |
---|
| 119 | ELSE:BEGIN |
---|
| 120 | firstx = firstxt |
---|
| 121 | lastx = lastxt |
---|
| 122 | firsty = firstyt |
---|
| 123 | lasty = lastyt |
---|
| 124 | END |
---|
| 125 | ENDCASE |
---|
| 126 | ; however for the vertical section we don''t whant to extent the domain |
---|
| 127 | ; in the direction perpendicular to the vertical section |
---|
| 128 | if type EQ 'xz' then begin |
---|
| 129 | case vargrid of |
---|
| 130 | 'U':BEGIN |
---|
| 131 | firsty = firstyu |
---|
| 132 | lasty = lastyu |
---|
| 133 | END |
---|
| 134 | 'V':BEGIN |
---|
| 135 | firsty = firstyv |
---|
| 136 | lasty = lastyv |
---|
| 137 | END |
---|
| 138 | 'F':BEGIN |
---|
| 139 | firsty = firstyf |
---|
| 140 | lasty = lastyf |
---|
| 141 | END |
---|
| 142 | ELSE: |
---|
| 143 | ENDCASE |
---|
| 144 | endif |
---|
| 145 | ; |
---|
| 146 | if type EQ 'yz' then begin |
---|
| 147 | case vargrid of |
---|
| 148 | 'U':BEGIN |
---|
| 149 | firstx = firstxu |
---|
| 150 | lastx = lastxu |
---|
| 151 | END |
---|
| 152 | 'V':BEGIN |
---|
| 153 | firstx = firstxv |
---|
| 154 | lastx = lastxv |
---|
| 155 | END |
---|
| 156 | 'F':BEGIN |
---|
| 157 | firstx = firstxf |
---|
| 158 | lastx = lastxf |
---|
| 159 | END |
---|
| 160 | ELSE: |
---|
| 161 | ENDCASE |
---|
| 162 | endif |
---|
| 163 | ; |
---|
| 164 | nx = lastx-firstx+1 |
---|
| 165 | ny = lasty-firsty+1 |
---|
| 166 | ;------------------------------------------------------------ |
---|
| 167 | ; horizontal grid |
---|
| 168 | ;------------------------------------------------------------ |
---|
| 169 | ; default case |
---|
| 170 | glam = glamt[firstx:lastx, firsty:lasty] |
---|
| 171 | gphi = gphit[firstx:lastx, firsty:lasty] |
---|
| 172 | ; for the vertical section, 2 cases: |
---|
| 173 | ; 1) keyword_set(realsection) eq 1: then we use drawsectionbottom.pro |
---|
| 174 | ; that directly draw the bottom using polyfill and plot. In this case, |
---|
| 175 | ; the position of the mask must given by the edge of the mask |
---|
| 176 | ; cells. As we are considering the edges of the mask cells, glam or |
---|
| 177 | ; gphi as one more point than the mask (if it is possible) |
---|
| 178 | ; 2) keyword_set(realsection) eq 0: then we draw the mask by contouring |
---|
| 179 | ; the mask with contour (contouring the level=.5). In this case, the |
---|
| 180 | ; mask position must be given by the middle on the mask cells. |
---|
| 181 | CASE type OF |
---|
| 182 | 'xz':BEGIN |
---|
| 183 | if keyword_set(realsection) EQ 0 then begin |
---|
| 184 | if vargrid EQ 'V' OR vargrid EQ 'F' then $ |
---|
| 185 | glam = glamv[firstx:lastx, firsty:lasty] |
---|
[226] | 186 | ENDIF ELSE BEGIN ; to drawsectionbottom |
---|
[14] | 187 | if vargrid EQ 'V' OR vargrid EQ 'F' OR finite(glamu[0]) EQ 0 then $ |
---|
| 188 | glam = glamf[0 > (firstx-1):lastx, firsty:lasty] $ |
---|
| 189 | ELSE glam = glamu[0 > (firstx-1):lastx, firsty:lasty] |
---|
| 190 | ENDELSE |
---|
| 191 | END |
---|
| 192 | 'yz':BEGIN |
---|
| 193 | if keyword_set(realsection) EQ 0 then begin |
---|
| 194 | if vargrid EQ 'U' OR vargrid EQ 'F' then $ |
---|
| 195 | gphi = gphiu[firstx:lastx, firsty:lasty] |
---|
[226] | 196 | ENDIF ELSE BEGIN ; to drawsectionbottom |
---|
[14] | 197 | if vargrid EQ 'U' OR vargrid EQ 'F' OR finite(gphiv[0]) EQ 0 then $ |
---|
| 198 | gphi = gphif[firstx:lastx, 0 > (firsty-1):lasty] $ |
---|
| 199 | ELSE gphi = gphiv[firstx:lastx, 0 > (firsty-1):lasty] |
---|
| 200 | ENDELSE |
---|
| 201 | END |
---|
| 202 | ELSE: |
---|
| 203 | ENDCASE |
---|
| 204 | ;------------------------------------------------------------ |
---|
| 205 | ; vertical boundaries |
---|
| 206 | ;------------------------------------------------------------ |
---|
| 207 | if keyword_set(wdepth) then begin |
---|
| 208 | firstz = 0 > (min([firstzt, firstzw])-1) |
---|
| 209 | lastz = (max([lastzt, lastzw])+1) < (jpk-1) |
---|
| 210 | ENDIF ELSE BEGIN |
---|
| 211 | firstz = firstzt |
---|
| 212 | lastz = lastzt |
---|
[226] | 213 | ENDELSE |
---|
[14] | 214 | nz = lastz-firstz+1 |
---|
| 215 | ;------------------------------------------------------------ |
---|
| 216 | ; mask |
---|
| 217 | ;------------------------------------------------------------ |
---|
| 218 | case type of |
---|
| 219 | 'xy':BEGIN |
---|
| 220 | mask = tmask[firstx:lastx, firsty:lasty, firstz] |
---|
| 221 | profond = firstz NE 0 |
---|
| 222 | END |
---|
[226] | 223 | ; for the vertical section, we have to choose the right mask according |
---|
[14] | 224 | ; to the grid point and to the direction of the section |
---|
| 225 | 'xz':BEGIN |
---|
| 226 | if vargrid EQ 'V' OR vargrid EQ 'F' then begin |
---|
| 227 | mask = (vmask())[firstx:lastx, firstyv:lastyv, firstz:lastz] |
---|
| 228 | ENDIF ELSE mask = tmask[firstx:lastx, firsty:lasty, firstz:lastz] |
---|
| 229 | END |
---|
| 230 | 'yz':BEGIN |
---|
| 231 | if vargrid EQ 'U' OR vargrid EQ 'F' then begin |
---|
| 232 | mask = (umask())[firstxu:lastxu, firsty:lasty, firstz:lastz] |
---|
| 233 | ENDIF ELSE mask = tmask[firstx:lastx, firsty:lasty, firstz:lastz] |
---|
| 234 | END |
---|
| 235 | ELSE:mask = tmask[firstx:lastx, firsty:lasty, firstz:lastz] |
---|
| 236 | endcase |
---|
| 237 | ;------------------------------------------------------------ |
---|
| 238 | ; vertical axis |
---|
| 239 | ;------------------------------------------------------------ |
---|
| 240 | ; when we do a real section we directly plot the gdepw |
---|
| 241 | ; (in drawsectionbottom.pro) instead of contouring the mask at 0.5 at |
---|
| 242 | ; gdept |
---|
| 243 | IF keyword_set(realsection) EQ 0 then gdep = gdept[firstz:lastz] $ |
---|
| 244 | ELSE BEGIN |
---|
| 245 | ; if lastz EQ jpk-1 then $ |
---|
| 246 | ; we add some fictive very deep level that will not be used but that is |
---|
| 247 | ; necessary to avoid array size bugs in draw bottom section |
---|
| 248 | ; gdep = [gdepw[firstz+1:lastz], 2*gdept[jpk-1]] $ |
---|
| 249 | ; ELSE gdep = gdepw[firstz+1:lastz+1] |
---|
| 250 | gdep = gdepw[firstz:lastz] |
---|
| 251 | ; special case when we are using the partial steps in the vertical |
---|
| 252 | ; section that are only 1 point wide. |
---|
| 253 | ; in that case, the z axis is a 2d array and we modify the depth of |
---|
| 254 | ; the last level ocean with hdepw that is the real depth of the bottom. |
---|
| 255 | CASE 1 OF |
---|
| 256 | keyword_set(key_partialstep) and type EQ 'xz' $ |
---|
| 257 | AND ny EQ 1 AND keyword_set(realsection):BEGIN |
---|
| 258 | bottom = total(mask, 3) |
---|
| 259 | good = where(bottom NE 0 AND bottom NE nz+1) |
---|
| 260 | bottom = lindgen(nx)+(bottom)*nx |
---|
| 261 | IF good[0] NE -1 THEN BEGIN |
---|
| 262 | bottom = bottom[good] |
---|
| 263 | gdep = replicate(1, nx)#gdep |
---|
| 264 | truegdep = hdepw[firstx:lastx, firsty:lasty] |
---|
| 265 | gdep[bottom] = truegdep[good] |
---|
| 266 | ENDIF |
---|
| 267 | END |
---|
| 268 | keyword_set(key_partialstep) and type EQ 'yz' $ |
---|
[226] | 269 | AND nx EQ 1 AND keyword_set(realsection):BEGIN |
---|
[14] | 270 | bottom = total(mask, 3) |
---|
| 271 | good = where(bottom NE 0 AND bottom NE nz+1) |
---|
| 272 | bottom = lindgen(ny)+(bottom)*ny |
---|
| 273 | IF good[0] NE -1 THEN BEGIN |
---|
| 274 | bottom = bottom[good] |
---|
| 275 | gdep = replicate(1, ny)#gdep |
---|
| 276 | truegdep = hdepw[firstx:lastx, firsty:lasty] |
---|
| 277 | gdep[bottom] = truegdep[good] |
---|
| 278 | ENDIF |
---|
| 279 | END |
---|
| 280 | ELSE: |
---|
| 281 | ENDCASE |
---|
| 282 | ENDELSE |
---|
| 283 | ;------------------------------------------------------------ |
---|
[142] | 284 | ; Triangulation vector when TRI is activated. |
---|
[14] | 285 | ;------------------------------------------------------------ |
---|
| 286 | IF arg_present(TRI) then $ |
---|
| 287 | if triangles_list[0] EQ -1 OR usetri LT 1 then tri = -1 ELSE BEGIN |
---|
[142] | 288 | ; If we are tracing a deep level, we redo the triangulation |
---|
[14] | 289 | if keyword_set(profond) then begin |
---|
| 290 | tri = triangule(mask, coinmonte = coinmonte, coindescend = coindescend, _extra = ex) |
---|
| 291 | indicezoom = (lindgen(jpi, jpj))[firstx:lastx, firsty:lasty] |
---|
[226] | 292 | ENDIF ELSE BEGIN |
---|
[142] | 293 | ; Otherwise, we recuperate the part of triangulation that interest us and we number them well!! |
---|
[226] | 294 | if nx EQ jpi AND ny EQ jpj then tri = triangles_list ELSE BEGIN |
---|
[14] | 295 | msk = bytarr(jpi, jpj) |
---|
| 296 | msk[firstx:lastx, firsty:lasty] = 1 |
---|
| 297 | ind = where( msk[triangles_list[0, *]] EQ 1 $ |
---|
| 298 | AND msk[triangles_list[1, *]] EQ 1 $ |
---|
| 299 | AND msk[triangles_list[2, *]] EQ 1 ) |
---|
| 300 | tri = triangles_list[*, ind]-(firstx+firsty*jpi) |
---|
| 301 | y = tri/jpi |
---|
| 302 | x = tri-y*jpi |
---|
| 303 | tri = x+y*nx |
---|
| 304 | ENDELSE |
---|
| 305 | ENDELSE |
---|
| 306 | ENDELSE |
---|
| 307 | ;------------------------------------------------------------------- |
---|
[226] | 308 | if keyword_set(key_performance) THEN print, 'temps decoupeterre', systime(1)-tempsun |
---|
[14] | 309 | ;------------------------------------------------------------ |
---|
| 310 | return |
---|
| 311 | end |
---|
| 312 | |
---|