1 |
edhill |
1.5 |
C $Header: /u/gcmpack/MITgcm/pkg/monitor/mon_stats_latbnd_rl.F,v 1.4 2004/03/05 02:28:11 jmc Exp $ |
2 |
jmc |
1.1 |
C $Name: $ |
3 |
|
|
|
4 |
|
|
#include "MONITOR_OPTIONS.h" |
5 |
|
|
|
6 |
edhill |
1.5 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
7 |
|
|
CBOP |
8 |
|
|
C !ROUTINE: MON_STATS_LATBND_RL |
9 |
|
|
|
10 |
|
|
C !INTERFACE: |
11 |
jmc |
1.1 |
SUBROUTINE MON_STATS_LATBND_RL( |
12 |
edhill |
1.5 |
I myNr, mskNr, kLoc, nSepBnd, ySepBnd, |
13 |
|
|
I arr, arrMask, arrhFac, arrArea, arrY, arrDr, |
14 |
|
|
O theMin,theMax,theMean,theVar,theVol, |
15 |
|
|
I myThid ) |
16 |
|
|
|
17 |
|
|
C !DESCRIPTION: |
18 |
|
|
C Calculate bare statistics of global array "\_RL arr" on each |
19 |
|
|
C Latitude band (given by \texttt{ySepBnd}). |
20 |
|
|
|
21 |
|
|
C !USES: |
22 |
jmc |
1.1 |
IMPLICIT NONE |
23 |
|
|
#include "SIZE.h" |
24 |
|
|
#include "EEPARAMS.h" |
25 |
edhill |
1.5 |
INTEGER NLATBND |
26 |
|
|
EXTERNAL NLATBND |
27 |
jmc |
1.1 |
|
28 |
edhill |
1.5 |
C !INPUT PARAMETERS: |
29 |
jmc |
1.1 |
C nSepBnd :: Number of latitude bands |
30 |
jmc |
1.3 |
C ySepBnd :: Southern latitude egde (from 2 to nSepBnd, 1 is not used) |
31 |
jmc |
1.2 |
INTEGER myNr, mskNr, kLoc |
32 |
jmc |
1.1 |
INTEGER nSepBnd |
33 |
|
|
_RS ySepBnd(nSepBnd) |
34 |
|
|
_RL arr(1-OLx:sNx+OLx,1-OLy:sNy+OLy,myNr,nSx,nSy) |
35 |
jmc |
1.2 |
_RS arrMask(1-OLx:sNx+OLx,1-OLy:sNy+OLy,mskNr,nSx,nSy) |
36 |
|
|
_RS arrhFac(1-OLx:sNx+OLx,1-OLy:sNy+OLy,mskNr,nSx,nSy) |
37 |
jmc |
1.1 |
_RS arrArea(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
38 |
|
|
_RS arrY(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
39 |
|
|
_RS arrDr(myNr) |
40 |
|
|
_RL theMin(nSepBnd) |
41 |
|
|
_RL theMax(nSepBnd) |
42 |
|
|
_RL theMean(nSepBnd) |
43 |
|
|
_RL theVar(nSepBnd) |
44 |
|
|
_RL theVol(nSepBnd) |
45 |
|
|
INTEGER myThid |
46 |
edhill |
1.5 |
CEOP |
47 |
jmc |
1.1 |
|
48 |
edhill |
1.5 |
C !LOCAL VARIABLES: |
49 |
jmc |
1.1 |
INTEGER bi,bj,i,j,k,n |
50 |
jmc |
1.2 |
INTEGER km, k1, k2 |
51 |
jmc |
1.1 |
INTEGER numPnts |
52 |
|
|
LOGICAL noPnts(Ny) |
53 |
|
|
_RL tmpVal,rNumPnts |
54 |
|
|
_RL tmpVol |
55 |
|
|
|
56 |
jmc |
1.2 |
C- set k index range [k1,k2] |
57 |
|
|
IF ( kLoc.EQ.0 ) THEN |
58 |
|
|
k1 = 1 |
59 |
|
|
k2 = myNr |
60 |
|
|
ELSE |
61 |
|
|
k1 = kLoc |
62 |
|
|
k2 = kLoc |
63 |
|
|
ENDIF |
64 |
|
|
|
65 |
jmc |
1.1 |
DO n=1,nSepBnd |
66 |
|
|
noPnts(n)=.TRUE. |
67 |
|
|
theMin(n)=0. |
68 |
|
|
theMax(n)=0. |
69 |
|
|
theMean(n)=0. |
70 |
|
|
theVar(n)=0. |
71 |
|
|
theVol(n)=0. |
72 |
|
|
ENDDO |
73 |
|
|
|
74 |
|
|
DO bj=myByLo(myThid),myByHi(myThid) |
75 |
|
|
DO bi=myBxLo(myThid),myBxHi(myThid) |
76 |
jmc |
1.2 |
DO k=k1,k2 |
77 |
|
|
km = MIN(k,mskNr) |
78 |
jmc |
1.1 |
DO j=1,sNy |
79 |
|
|
DO i=1,sNx |
80 |
|
|
n = NLATBND(nSepBnd, ySepBnd, arrY(i,j,bi,bj) ) |
81 |
|
|
tmpVal=arr(i,j,k,bi,bj) |
82 |
jmc |
1.2 |
IF (arrMask(i,j,km,bi,bj).NE.0. .AND. noPnts(n)) THEN |
83 |
jmc |
1.1 |
theMin(n)=tmpVal |
84 |
|
|
theMax(n)=tmpVal |
85 |
|
|
noPnts(n)=.FALSE. |
86 |
|
|
ENDIF |
87 |
jmc |
1.2 |
IF (arrMask(i,j,km,bi,bj).NE.0.) THEN |
88 |
jmc |
1.3 |
theMin(n)=MIN(theMin(n),tmpVal) |
89 |
|
|
theMax(n)=MAX(theMax(n),tmpVal) |
90 |
jmc |
1.2 |
tmpVol = arrArea(i,j,bi,bj)*arrhFac(i,j,km,bi,bj)*arrDr(k) |
91 |
|
|
& *arrMask(i,j,km,bi,bj) |
92 |
jmc |
1.1 |
theVol(n) = theVol(n) + tmpVol |
93 |
jmc |
1.2 |
theMean(n)= theMean(n)+ tmpVol*tmpVal |
94 |
jmc |
1.1 |
theVar(n) = theVar(n) + tmpVol*tmpVal*tmpVal |
95 |
|
|
ENDIF |
96 |
|
|
ENDDO |
97 |
|
|
ENDDO |
98 |
|
|
ENDDO |
99 |
|
|
ENDDO |
100 |
|
|
ENDDO |
101 |
|
|
|
102 |
|
|
DO n=1,nSepBnd |
103 |
|
|
_GLOBAL_SUM_R8(theVol(n), myThid) |
104 |
|
|
_GLOBAL_SUM_R8(theMean(n),myThid) |
105 |
|
|
_GLOBAL_SUM_R8(theVar(n), myThid) |
106 |
|
|
ENDDO |
107 |
|
|
|
108 |
|
|
DO n=1,nSepBnd |
109 |
|
|
IF (theVol(n).GT.0.) THEN |
110 |
|
|
theMean(n)= theMean(n)/theVol(n) |
111 |
|
|
theVar(n) = theVar(n) /theVol(n) |
112 |
jmc |
1.4 |
theVar(n) = theVar(n) -theMean(n)*theMean(n) |
113 |
|
|
IF ( noPnts(n) ) theMin(n) = theMean(n) |
114 |
|
|
theMin(n) = -theMin(n) |
115 |
|
|
_GLOBAL_MAX_R8(theMin(n), myThid) |
116 |
|
|
theMin(n)=-theMin(n) |
117 |
|
|
IF ( noPnts(n) ) theMax(n) = theMin(n) |
118 |
|
|
_GLOBAL_MAX_R8(theMax(n), myThid) |
119 |
jmc |
1.1 |
ENDIF |
120 |
|
|
ENDDO |
121 |
|
|
|
122 |
|
|
RETURN |
123 |
|
|
END |
124 |
|
|
|
125 |
edhill |
1.5 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
126 |
jmc |
1.1 |
CBOP |
127 |
|
|
C !ROUTINE: NLATBND |
128 |
|
|
|
129 |
|
|
C !INTERFACE: |
130 |
|
|
INTEGER FUNCTION NLATBND( nBnd, yBnd, yLoc ) |
131 |
|
|
IMPLICIT NONE |
132 |
|
|
|
133 |
|
|
C !DESCRIPTION: |
134 |
edhill |
1.5 |
C Find the latidude band of yLoc in nSep strip |
135 |
|
|
|
136 |
jmc |
1.1 |
C !INPUT PARAMETERS: |
137 |
jmc |
1.3 |
C nBnd :: Number of latitude bands |
138 |
|
|
C yBnd :: latitude of southern boundary (for each lat. band) |
139 |
jmc |
1.1 |
C yLoc :: current latitude |
140 |
|
|
INTEGER nBnd |
141 |
|
|
_RS yBnd(nBnd) |
142 |
|
|
_RS yLoc |
143 |
edhill |
1.5 |
CEOP |
144 |
jmc |
1.1 |
|
145 |
|
|
C !LOCAL VARIABLES: |
146 |
|
|
INTEGER n |
147 |
|
|
|
148 |
jmc |
1.3 |
NLATBND = 1 |
149 |
|
|
DO n=2,nBnd |
150 |
|
|
IF (yLoc .GT. yBnd(n)) NLATBND = n |
151 |
jmc |
1.1 |
ENDDO |
152 |
|
|
|
153 |
|
|
RETURN |
154 |
|
|
END |
155 |
edhill |
1.5 |
|
156 |
|
|
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |