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

Last change on this file since 193 was 193, checked in by pinsard, 14 years ago

homogenize enter messages

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