source: trunk/SRC/Computation/e3w_3d.pro @ 447

Last change on this file since 447 was 447, checked in by smasson, 13 years ago

bugfix related to changeset:445

File size: 2.0 KB
Line 
1;+
2;
3; @file_comments
4; compute the 3D e3w from e3w and e3w_ps
5;
6; @categories
7; diagnostics
8;
9; @keyword e1 {default=0}{type=scalar: 0 or 1}
10; activate to compute e1t * e3w instead of e3w
11; note that of both keywords e1 and e2 are acticated we compute e1t * e2t * e3w instead of e3w
12;
13; @keyword e2 {default=0}{type=scalar: 0 or 1}
14; activate to compute e2t * e3w instead of e3w
15; note that of both keywords e1 and e2 are acticated we compute e1t * e2t * e3w instead of e3w
16;
17; @returns
18; e3w
19;
20; @uses
21; cm_4mesh.pro
22;
23; @history
24; Sebastien Masson, Jan 2011
25;
26; @version
27; $Id$
28;
29;-
30function e3w_3d, e1 = e1, e2 = e2
31;
32  compile_opt idl2, strictarrsubs
33;
34@cm_4mesh
35;
36  CASE 1 OF
37    keyword_set(e1) AND keyword_set(e2):arr2d = e1t[firstxt:lastxt, firstyt:lastyt] $
38                                              * e2t[firstxt:lastxt, firstyt:lastyt]
39    keyword_set(e1):arr2d = e1t[firstxt:lastxt, firstyt:lastyt]
40    keyword_set(e2):arr2d = e2t[firstxt:lastxt, firstyt:lastyt]
41    ELSE:arr2d = replicate(1., nxt*nyt)
42  ENDCASE
43  e3w_3d = arr2d[*] # e3w[firstzw:lastzw]
44  e3w_3d = reform(e3w_3d, nxt, nyt, nzw, /overwrite)   
45;
46  IF keyword_set(key_partialstep) THEN BEGIN
47; Change bottom values with e3t_ps
48; level of the bottom of the ocean
49    bottom = total(tmask[firstxt:lastxt, firstyt:lastyt, *], 3)
50    bottom2 = long(temporary(bottom)) - firstzw
51    bottom  = bottom2 - 1L
52    ok  = where(bottom  GE 0 AND bottom  LT nzw)
53    ok2 = where(bottom2 GE 0 AND bottom2 LT nzw)
54; apply e3w_ps to e3w_3D at the bottom of the ocean
55    IF ok[0]  NE -1 THEN BEGIN
56; the bottom of the ocean in 3D index is:
57      bottom  = (lindgen(nxt*nyt))[ok ] + nxt*nyt*(temporary(bottom ))[ok ]
58      e3w_3d[bottom ] = arr2d[ok ] * (e3w_ps[firstxt:lastxt, firstyt:lastyt])[ok ]
59    ENDIF
60    IF ok2[0] NE -1 THEN BEGIN
61      bottom2 = (lindgen(nxt*nyt))[ok2] + nxt*nyt*(temporary(bottom2))[ok2]
62      e3w_3d[bottom2] = arr2d[ok2] * (e3t_ps[firstxt:lastxt, firstyt:lastyt])[ok2] ; use e3t_ps and not e3w_ps
63    ENDIF
64  ENDIF
65;
66  return, e3w_3d
67END
68
Note: See TracBrowser for help on using the repository browser.