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

Last change on this file since 495 was 495, checked in by pinsard, 10 years ago

fix thanks to coding rules; typo; dupe empty lines; trailing blanks

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 activated 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 activated 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.d, 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    sea = where(bottom NE 0)
51    bottom2 = long(temporary(bottom)) - firstzw
52    bottom  = bottom2 - 1L
53    ok  = inter(sea, where(bottom  GE 0 AND bottom  LT nzw))
54    ok2 = inter(sea, where(bottom2 GE 0 AND bottom2 LT nzw))
55; apply e3w_ps to e3w_3D at the bottom of the ocean
56    IF ok[0]  NE -1 THEN BEGIN
57; the bottom of the ocean in 3D index is:
58      bottom  = (lindgen(nxt*nyt))[ok ] + nxt*nyt*(temporary(bottom ))[ok ]
59      e3w_3d[bottom ] = arr2d[ok ] * (e3w_ps[firstxt:lastxt, firstyt:lastyt])[ok ]
60    ENDIF
61    IF ok2[0] NE -1 THEN BEGIN
62      bottom2 = (lindgen(nxt*nyt))[ok2] + nxt*nyt*(temporary(bottom2))[ok2]
63      e3w_3d[bottom2] = arr2d[ok2] * (e3t_ps[firstxt:lastxt, firstyt:lastyt])[ok2] ; use e3t_ps and not e3w_ps
64    ENDIF
65  ENDIF
66;
67  return, e3w_3d
68END
Note: See TracBrowser for help on using the repository browser.