;+ ; ; @file_comments ; compute the 3D e3v from e3t and e3t_ps ; ; @categories ; diagnostics ; ; @keyword e1 {default=0}{type=scalar: 0 or 1} ; activate to compute e1v * e3v instead of e3v ; note that of both keywords e1 and e2 are activated we compute e1v * e2v * e3v instead of e3v ; ; @keyword e2 {default=0}{type=scalar: 0 or 1} ; activate to compute e2v * e3v instead of e3v ; note that of both keywords e1 and e2 are activated we compute e1v * e2v * e3v instead of e3v ; ; @returns ; e3v 3D array ; ; @uses ; cm_4mesh.pro ; ; @history ; Sebastien Masson, Jan 2011 ; ; @version ; $Id$ ; ;- function e3v_3d, e1 = e1, e2 = e2 ; compile_opt idl2, strictarrsubs ; @cm_4mesh ; IF keyword_set(key_partialstep) THEN lasty = ( lastyv + 1 ) < ( jpj - 1 ) ELSE lasty = lastyv ny = lasty - firstyv + 1 ; get e3t 3D e3t3d = e3t_3d(fstx = firstxv, lstx = lastxv, fsty = firstyv, lsty = lasty) ; IF keyword_set(key_partialstep) THEN BEGIN ; Rebuild the V-point 3D partial steps array from T-point 3D e3t_3D array tmp = shift(e3t3d, 0, -1, 0) IF ny EQ nyv THEN tmp[*, ny-1, *] = e3t3d[*, ny-1, *] e3v3d = [ [ (temporary(e3t3d))[*] ], [ (temporary(tmp))[*] ] ] e3v3d = min(temporary(e3v3d), dimension = 2) e3v3d = reform(e3v3d, nxv, ny, nzt, /overwrite) ; IF ny EQ nyv + 1 THEN e3v3d = (temporary(e3v3d))[*, 0:ny-2, *] ; ENDIF ELSE e3v3d = temporary(e3t3d) ; CASE 1 OF keyword_set(e1) AND keyword_set(e2):arr2d = e1v[firstxv:lastxv, firstyv:lastyv] $ * e2v[firstxv:lastxv, firstyv:lastyv] keyword_set(e1) :arr2d = e1v[firstxv:lastxv, firstyv:lastyv] keyword_set(e2):arr2d = e2v[firstxv:lastxv, firstyv:lastyv] ELSE: ENDCASE ; IF n_elements(arr2d) NE 0 THEN e3v3d = temporary(e3v3d) * ( arr2d[*] # replicate(1.d, nzt) ) ; return, e3v3d END