/[MITgcm]/MITgcm/pkg/monitor/mon_stats_latbnd_rl.F
ViewVC logotype

Annotation of /MITgcm/pkg/monitor/mon_stats_latbnd_rl.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.8 - (hide annotations) (download)
Tue Apr 28 18:16:53 2009 UTC (15 years, 2 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint64y, checkpoint64x, checkpoint64z, checkpoint64q, checkpoint64p, checkpoint64s, checkpoint64r, checkpoint64u, checkpoint64t, checkpoint64w, checkpoint64v, checkpoint64i, checkpoint64h, checkpoint64k, checkpoint64j, checkpoint64m, checkpoint64l, checkpoint64o, checkpoint64n, checkpoint64a, checkpoint64c, checkpoint64b, checkpoint64e, checkpoint64d, checkpoint64g, checkpoint64f, checkpoint63p, checkpoint63q, checkpoint63r, checkpoint63s, checkpoint63l, checkpoint63m, checkpoint63n, checkpoint63o, checkpoint63h, checkpoint63i, checkpoint63j, checkpoint63k, checkpoint63d, checkpoint63e, checkpoint63f, checkpoint63g, checkpoint63a, checkpoint63b, checkpoint63c, checkpoint64, checkpoint65, checkpoint62, checkpoint63, checkpoint66g, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint66o, checkpoint66n, checkpoint66m, checkpoint66l, checkpoint66k, checkpoint66j, checkpoint66i, checkpoint66h, checkpoint65z, checkpoint65x, checkpoint65y, checkpoint65r, checkpoint65s, checkpoint65p, checkpoint65q, checkpoint65v, checkpoint65w, checkpoint65t, checkpoint65u, checkpoint65j, checkpoint65k, checkpoint65h, checkpoint65i, checkpoint65n, checkpoint65o, checkpoint65l, checkpoint65m, checkpoint65b, checkpoint65c, checkpoint65a, checkpoint65f, checkpoint65g, checkpoint65d, checkpoint65e, checkpoint62c, checkpoint62b, checkpoint62a, checkpoint62g, checkpoint62f, checkpoint62e, checkpoint62d, checkpoint62k, checkpoint62j, checkpoint62i, checkpoint62h, checkpoint62o, checkpoint62n, checkpoint62m, checkpoint62l, checkpoint62s, checkpoint62r, checkpoint62q, checkpoint62p, checkpoint62w, checkpoint62v, checkpoint62u, checkpoint62t, checkpoint62z, checkpoint62y, checkpoint62x, checkpoint61n, checkpoint61o, checkpoint61m, checkpoint61v, checkpoint61w, checkpoint61t, checkpoint61u, checkpoint61r, checkpoint61s, checkpoint61p, checkpoint61q, checkpoint61z, checkpoint61x, checkpoint61y, HEAD
Changes since 1.7: +3 -3 lines
change macros (EXCH & GLOBAL_SUM/MAX) sufix _R4/_R8 to _RS/_RL
 when applied to _RS/_RL variable

1 jmc 1.8 C $Header: /u/gcmpack/MITgcm/pkg/monitor/mon_stats_latbnd_rl.F,v 1.7 2007/10/15 00:18:40 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.7 C msgBuf :: Informational/error meesage buffer
50     CHARACTER*(MAX_LEN_MBUF) msgBuf
51 jmc 1.1 INTEGER bi,bj,i,j,k,n
52 jmc 1.2 INTEGER km, k1, k2
53 jmc 1.1 LOGICAL noPnts(Ny)
54 jmc 1.6 _RL tmpVal
55 jmc 1.1 _RL tmpVol
56 jmc 1.7 INTEGER nSepDim
57     PARAMETER ( nSepDim = 200 )
58     _RL tileVol (nSx,nSy,nSepDim)
59     _RL tileMean(nSx,nSy,nSepDim)
60     _RL tileVar (nSx,nSy,nSepDim)
61    
62     C- Check local Dim
63     IF ( nSepBnd .GT. nSepDim ) THEN
64     WRITE(msgBuf,'(A,I6,A)')
65     & 'MON_STATS_LATBND_RL: local array Dim (nSepDim=',nSepDim,
66     & ' ) too small'
67     CALL PRINT_ERROR( msgBuf , myThid)
68     WRITE(msgBuf,'(A,I6)')
69     & 'MON_STATS_LATBND_RL: Need nSepDim to be at least =', nSepBnd
70     CALL PRINT_ERROR( msgBuf , myThid)
71     STOP 'ABNORMAL END: S/R MON_STATS_LATBND_RL'
72     ENDIF
73 jmc 1.1
74 jmc 1.2 IF ( kLoc.EQ.0 ) THEN
75     k1 = 1
76     k2 = myNr
77     ELSE
78     k1 = kLoc
79     k2 = kLoc
80     ENDIF
81    
82 jmc 1.1 DO n=1,nSepBnd
83     noPnts(n)=.TRUE.
84     theMin(n)=0.
85     theMax(n)=0.
86     theMean(n)=0.
87     theVar(n)=0.
88     theVol(n)=0.
89     ENDDO
90    
91     DO bj=myByLo(myThid),myByHi(myThid)
92     DO bi=myBxLo(myThid),myBxHi(myThid)
93 jmc 1.7 DO n=1,nSepBnd
94     tileVol (bi,bj,n) = 0.
95     tileMean(bi,bj,n) = 0.
96     tileVar (bi,bj,n) = 0.
97     ENDDO
98 jmc 1.2 DO k=k1,k2
99     km = MIN(k,mskNr)
100 jmc 1.1 DO j=1,sNy
101     DO i=1,sNx
102     n = NLATBND(nSepBnd, ySepBnd, arrY(i,j,bi,bj) )
103     tmpVal=arr(i,j,k,bi,bj)
104 jmc 1.2 IF (arrMask(i,j,km,bi,bj).NE.0. .AND. noPnts(n)) THEN
105 jmc 1.1 theMin(n)=tmpVal
106     theMax(n)=tmpVal
107     noPnts(n)=.FALSE.
108     ENDIF
109 jmc 1.2 IF (arrMask(i,j,km,bi,bj).NE.0.) THEN
110 jmc 1.3 theMin(n)=MIN(theMin(n),tmpVal)
111     theMax(n)=MAX(theMax(n),tmpVal)
112 jmc 1.2 tmpVol = arrArea(i,j,bi,bj)*arrhFac(i,j,km,bi,bj)*arrDr(k)
113     & *arrMask(i,j,km,bi,bj)
114 jmc 1.7 tileVol (bi,bj,n) = tileVol (bi,bj,n) + tmpVol
115     tileMean(bi,bj,n) = tileMean(bi,bj,n) + tmpVol*tmpVal
116     tileVar (bi,bj,n) = tileVar (bi,bj,n) + tmpVol*tmpVal*tmpVal
117 jmc 1.1 ENDIF
118     ENDDO
119     ENDDO
120     ENDDO
121     ENDDO
122     ENDDO
123    
124     DO n=1,nSepBnd
125 jmc 1.7 CALL GLOBAL_SUM_TILE_RL( tileVol(1,1,n) , theVol(n) , myThid )
126     CALL GLOBAL_SUM_TILE_RL( tileMean(1,1,n), theMean(n), myThid )
127     CALL GLOBAL_SUM_TILE_RL( tileVar(1,1,n) , theVar(n) , myThid )
128 jmc 1.1 ENDDO
129    
130     DO n=1,nSepBnd
131     IF (theVol(n).GT.0.) THEN
132     theMean(n)= theMean(n)/theVol(n)
133     theVar(n) = theVar(n) /theVol(n)
134 jmc 1.4 theVar(n) = theVar(n) -theMean(n)*theMean(n)
135     IF ( noPnts(n) ) theMin(n) = theMean(n)
136     theMin(n) = -theMin(n)
137 jmc 1.8 _GLOBAL_MAX_RL(theMin(n), myThid)
138 jmc 1.4 theMin(n)=-theMin(n)
139     IF ( noPnts(n) ) theMax(n) = theMin(n)
140 jmc 1.8 _GLOBAL_MAX_RL(theMax(n), myThid)
141 jmc 1.1 ENDIF
142     ENDDO
143    
144     RETURN
145     END
146 jmc 1.7
147 edhill 1.5 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
148 jmc 1.1 CBOP
149     C !ROUTINE: NLATBND
150    
151     C !INTERFACE:
152     INTEGER FUNCTION NLATBND( nBnd, yBnd, yLoc )
153     IMPLICIT NONE
154    
155     C !DESCRIPTION:
156 edhill 1.5 C Find the latidude band of yLoc in nSep strip
157    
158 jmc 1.1 C !INPUT PARAMETERS:
159 jmc 1.3 C nBnd :: Number of latitude bands
160     C yBnd :: latitude of southern boundary (for each lat. band)
161 jmc 1.1 C yLoc :: current latitude
162     INTEGER nBnd
163 jmc 1.7 _RS yBnd(nBnd)
164 jmc 1.1 _RS yLoc
165 edhill 1.5 CEOP
166 jmc 1.1
167     C !LOCAL VARIABLES:
168     INTEGER n
169    
170 jmc 1.3 NLATBND = 1
171     DO n=2,nBnd
172     IF (yLoc .GT. yBnd(n)) NLATBND = n
173 jmc 1.1 ENDDO
174    
175     RETURN
176     END
177 edhill 1.5
178     C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|

  ViewVC Help
Powered by ViewVC 1.1.22