[445] | 1 | ;+ |
---|
| 2 | ; |
---|
| 3 | ; @file_comments |
---|
| 4 | ; compute the 3D e3t from e3t and e3t_ps |
---|
| 5 | ; |
---|
| 6 | ; @categories |
---|
| 7 | ; diagnostics |
---|
| 8 | ; |
---|
| 9 | ; @keyword e1 {default=0}{type=scalar: 0 or 1} |
---|
| 10 | ; activate to compute e1t * e3t instead of e3t |
---|
| 11 | ; note that of both keywords e1 and e2 are acticated we compute e1t * e2t * e3t instead of e3t |
---|
| 12 | ; |
---|
| 13 | ; @keyword e2 {default=0}{type=scalar: 0 or 1} |
---|
| 14 | ; activate to compute e2t * e3t instead of e3t |
---|
| 15 | ; note that of both keywords e1 and e2 are acticated we compute e1t * e2t * e3t instead of e3t |
---|
| 16 | ; |
---|
| 17 | ; @returns |
---|
| 18 | ; e3t |
---|
| 19 | ; |
---|
| 20 | ; @uses |
---|
| 21 | ; cm_4mesh.pro |
---|
| 22 | ; |
---|
| 23 | ; @history |
---|
| 24 | ; Sebastien Masson, Jan 2011 |
---|
| 25 | ; |
---|
| 26 | ; @version |
---|
| 27 | ; $Id$ |
---|
| 28 | ; |
---|
| 29 | ;- |
---|
| 30 | function e3t_3d, e1 = e1, e2 = e2, fstx = fstx, lstx = lstx, fsty = fsty, lsty = lsty |
---|
| 31 | ; |
---|
| 32 | compile_opt idl2, strictarrsubs |
---|
| 33 | ; |
---|
| 34 | @cm_4mesh |
---|
| 35 | ; |
---|
| 36 | IF n_elements(fstx) NE 0 THEN fstx = firstxt |
---|
| 37 | IF n_elements(lstx) NE 0 THEN lstx = lastxt |
---|
| 38 | IF n_elements(fsty) NE 0 THEN fsty = firstyt |
---|
| 39 | IF n_elements(lsty) NE 0 THEN lsty = lastyt |
---|
| 40 | nx = lstx - fstx + 1 |
---|
| 41 | ny = lsty - fsty + 1 |
---|
| 42 | ; |
---|
| 43 | CASE 1 OF |
---|
| 44 | keyword_set(e1) AND keyword_set(e2):arr2d = e1t[fstx:lstx, fsty:lsty] * e2t[fstx:lstx, fsty:lsty] |
---|
| 45 | keyword_set(e1) :arr2d = e1t[fstx:lstx, fsty:lsty] |
---|
| 46 | keyword_set(e2):arr2d = e2t[fstx:lstx, fsty:lsty] |
---|
| 47 | ELSE:arr2d = replicate(1., nx*ny) |
---|
| 48 | ENDCASE |
---|
| 49 | e3t3d = arr2d[*] # e3t[firstzt:lastzt] |
---|
| 50 | e3t3d = reform(e3t3d, nx, ny, nzt, /overwrite) |
---|
| 51 | ; |
---|
| 52 | IF keyword_set(key_partialstep) THEN BEGIN |
---|
| 53 | ; Change bottom values with e3t_ps |
---|
| 54 | ; level of the bottom of the ocean |
---|
| 55 | bottom = total(tmask[fstx:lstx, fsty:lsty, *], 3) |
---|
| 56 | bottom2 = long(temporary(bottom)) - firstzt |
---|
| 57 | bottom = bottom2 - 1L |
---|
| 58 | ok = where(bottom GE 0 AND bottom LT nzt) |
---|
| 59 | ok2 = where(bottom2 GE 0 AND bottom2 LT nzt) |
---|
| 60 | ; apply e3t_ps to e3t_3D at the bottom of the ocean |
---|
| 61 | IF ok[0] NE -1 THEN BEGIN |
---|
| 62 | ; the bottom of the ocean in 3D index is: |
---|
| 63 | bottom = lindgen(nx*ny) + nx*ny*(temporary(bottom ))[ok ] |
---|
| 64 | e3t3d[temporary(bottom )] = arr2d[ok ] * (e3t_ps[fstx:lstx, fsty:lsty])[ok ] |
---|
| 65 | ENDIF |
---|
| 66 | IF ok2[0] NE -1 THEN BEGIN |
---|
| 67 | bottom2 = lindgen(nx*ny) + nx*ny*(temporary(bottom2))[ok2] |
---|
| 68 | e3t3d[temporary(bottom2)] = arr2d[ok2] * (e3t_ps[fstx:lstx, fsty:lsty])[ok2] |
---|
| 69 | ENDIF |
---|
| 70 | ; |
---|
| 71 | ENDIF |
---|
| 72 | ; |
---|
| 73 | return, e3t3d |
---|
| 74 | END |
---|
| 75 | |
---|