source: trunk/procs/macros/make_wwv.pro @ 170

Last change on this file since 170 was 170, checked in by pinsard, 15 years ago

fill uses paragraph in header with used commons

  • Property svn:keywords set to Id
File size: 3.5 KB
Line 
1;+
2;
3; Estimation of the Warm Water Volume
4;
5; @uses
6; <pro>common</pro>
7; <propost_it>com_eg</propost_it>
8;
9; @version
10; $Id$
11;
12;-
13FUNCTION make_wwv, file_name, ncdf_db $
14         , BOXZOOM=boxzoom $
15         , TIME_1=time_1 $
16         , TIME_2=time_2 $
17         , ALL_DATA=all_data
18;
19  compile_opt idl2, strictarrsubs
20;
21@common
22@com_eg
23;
24   IF debug_w THEN print, '   ENTER make_wwv... '
25;
26; Read t
27;
28   vert_type = '0'
29
30   tn = nc_read(file_name,macro_base_fld, ncdf_db, BOXZOOM = boxzoom, TIME_1 = time_1, TIME_2 = time_2)
31
32   IF tn.units EQ 'C' THEN BEGIN
33      thermo = 20.
34   ENDIF
35   IF tn.units EQ 'K' THEN BEGIN
36      thermo = 293.15
37   ENDIF
38
39; Compute depth of 20C isotherm (from diahth.F of OPA)
40;
41; ... initialization to the number of ocean w-point mbathy
42
43
44   ik20c = lonarr(nxt,nyt,jpt)
45   ik20c[*, *, *] = -1
46   hd20 = fltarr(nxt,nyt,jpt)
47   hd20[*, *, *] = 0.
48   wwv = fltarr(jpt)
49   wwv[*] = 0.
50   tempm = fltarr(nxt,nyt,nzt)
51   tempm[*, *, *] = 1
52
53   grille,mask,glam,gphi,gdep,nx,ny,nz,firstx,firsty,firstz,lastx,lasty,lastz
54
55; ... search the depth of 20 degrees isotherm
56;     ( starting from the top, last level above 20C, if not exist, = 1)
57
58   FOR jk = 0, nzt-1 DO  BEGIN
59      idx = where ( tn.data[*, *, jk,*] GE thermo)
60      IF idx[0] NE -1 THEN ik20c[idx] = jk
61   ENDFOR
62
63
64; depth is a linear interpolation
65   bad = WHERE(~FINITE(tn.data[*, *, *, *]) )
66   tn.data[bad] = 1.e20
67   valmask = 1.e20
68   tempm[bad] = 0
69
70   IF debug_w THEN help, hd20
71   IF debug_w THEN print, 'min(hd20), max(hd20) : ', min(hd20), max(hd20)
72
73
74   FOR jt = 0, jpt-1 DO BEGIN
75      FOR jj = 0, nyt-1 DO BEGIN
76         FOR ji = 0, nxt-1 DO BEGIN
77            IF tn.data[ji, jj, 0, jt] LT valmask/10. THEN BEGIN
78               idx20 = ik20c[ji, jj, jt]
79               IF idx20 GE 0 THEN BEGIN
80                  hd20[ji, jj, jt] = gdept[idx20] +$
81                   
82                  ( gdept[idx20+1]- gdept[idx20] ) * $ ;DELTAZ entre les niveaux i et i+1
83                   mask[ji, jj, idx20+1] * ( thermo - tn.data[ji, jj, idx20, jt] )  $ ;DELTAT entre la hd20 et le niveau i
84                   / ( tn.data[ji, jj, idx20+1, jt] - tn.data[ji, jj, idx20, jt] ) ;variation de T entre les niveau i et i+1(dT/dz)
85               ENDIF
86            ENDIF ELSE BEGIN hd20[ji, jj, *] = -1.
87            ENDELSE   
88         ENDFOR 
89      ENDFOR
90   ENDFOR
91
92;--------------------------------------------------------------------------------
93;------------------------calcul du wwv-------------------------------------------
94;--------------------------------------------------------------------------------
95   IF debug_w THEN help, hd20
96   IF debug_w THEN print, 'min(hd20), max(hd20) : ', min(hd20), max(hd20)
97
98
99   FOR jt = 0, jpt-1 DO BEGIN
100      FOR jj = 0, nyt-1 DO BEGIN
101         FOR ji = 0, nxt-1 DO BEGIN
102            IF hd20[ji, jj, jt] NE -1. THEN BEGIN
103               wwv[jt] = wwv[jt] + hd20[ji, jj,jt]*e1t[firstx+ji, firsty+jj]*e2t[firstx+ji, firsty+jj]
104            ENDIF
105         ENDFOR
106      ENDFOR
107   ENDFOR
108
109;--------------------------------------------------------------------------------
110;--------------------------------------------------------------------------------
111;--------------------------------------------------------------------------------
112; bound by the ocean depth, minimum value, first T-point depth
113;          hd20[ji,jj] = min( zd20, fsdepw[ji,jj,mbathy[ji,jj]] )
114   field = {name: '', data: wwv, legend: '', units: '', origin: '', dim: 1, direc:'t'}
115
116   IF debug_w THEN print, tn.origin, tn.direc
117
118   field.origin = tn.origin
119
120   return, field
121   IF debug_w THEN print, '   ... EXIT make_wwv. '
122END
Note: See TracBrowser for help on using the repository browser.