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

Diff of /MITgcm/pkg/monitor/mon_stats_rl.F

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

revision 1.2 by adcroft, Mon Jun 4 20:04:24 2001 UTC revision 1.3 by jmc, Thu Nov 8 16:47:34 2001 UTC
# Line 4  C $Name$ Line 4  C $Name$
4  #include "CPP_OPTIONS.h"  #include "CPP_OPTIONS.h"
5    
6        SUBROUTINE MON_STATS_RL(        SUBROUTINE MON_STATS_RL(
7       I                myNr, arr,       I                myNr, arr, arrMask,arrhFac, arrArea, arrDr,
8       O                theMin,theMax,theMean,theSD,       O                theMin,theMax,theMean,theSD,theDel2,
9       I                myThid )       I                myThid )
10  C     /==========================================================\  C     /==========================================================\
11  C     | SUBROUTINE MON_STATS_RL                                  |  C     | SUBROUTINE MON_STATS_RL                                  |
# Line 21  C     === Global data === Line 21  C     === Global data ===
21  C     === Routine arguments ===  C     === Routine arguments ===
22        INTEGER myNr        INTEGER myNr
23        _RL arr(1-OLx:sNx+OLx,1-OLy:sNy+OLy,myNr,nSx,nSy)        _RL arr(1-OLx:sNx+OLx,1-OLy:sNy+OLy,myNr,nSx,nSy)
24          _RS arrMask(1-OLx:sNx+OLx,1-OLy:sNy+OLy,myNr,nSx,nSy)
25          _RS arrhFac(1-OLx:sNx+OLx,1-OLy:sNy+OLy,myNr,nSx,nSy)
26          _RS arrArea(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
27          _RS arrDr(myNr)
28        _RL theMin        _RL theMin
29        _RL theMax        _RL theMax
30        _RL theMean        _RL theMean
31        _RL theSD        _RL theSD
32          _RL theDel2
33        INTEGER myThid        INTEGER myThid
34    
35  C     === Local variables ====  C     === Local variables ====
# Line 33  C     === Local variables ==== Line 38  C     === Local variables ====
38        LOGICAL noPnts        LOGICAL noPnts
39        _RL tmpVal,rNumPnts        _RL tmpVal,rNumPnts
40        _RL theVar        _RL theVar
41          _RL theVol, tmpVol
42    
43        theMin=0.        theMin=0.
44        theMax=0.        theMax=0.
45        theMean=0.        theMean=0.
46        theSD=0.        theSD=0.
47        theVar=0.        theVar=0.
48          theDel2=0.
49          theVol=0.
50        numPnts=0        numPnts=0
51        noPnts=.TRUE.        noPnts=.TRUE.
52    
# Line 48  C     === Local variables ==== Line 56  C     === Local variables ====
56           DO J=1,sNy           DO J=1,sNy
57            DO I=1,sNx            DO I=1,sNx
58             tmpVal=arr(I,J,K,bi,bj)             tmpVal=arr(I,J,K,bi,bj)
59             IF (tmpVal.NE.0. .AND. noPnts) THEN  c          IF (tmpVal.NE.0. .AND. noPnts) THEN
60               IF (arrMask(I,J,K,bi,bj).NE.0. .AND. noPnts) THEN
61              theMin=tmpVal              theMin=tmpVal
62              theMax=tmpVal              theMax=tmpVal
63              noPnts=.FALSE.              noPnts=.FALSE.
64             ENDIF             ENDIF
65             IF (tmpVal.NE.0.) THEN  c          IF (tmpVal.NE.0.) THEN
66               IF (arrMask(I,J,K,bi,bj).NE.0.) THEN
67              theMin=min(theMin,tmpVal)              theMin=min(theMin,tmpVal)
68              theMax=max(theMax,tmpVal)              theMax=max(theMax,tmpVal)
69              theMean=theMean+tmpVal              theDel2 = theDel2+0.25*ABS(
70              theVar=theVar+tmpVal**2       &         (arr(I+1,J,K,bi,bj)-tmpVal)*arrMask(I+1,J,K,bi,bj)
71         &        +(arr(I-1,J,K,bi,bj)-tmpVal)*arrMask(I-1,J,K,bi,bj)
72         &        +(arr(I,J+1,K,bi,bj)-tmpVal)*arrMask(I,J+1,K,bi,bj)
73         &        +(arr(I,J-1,K,bi,bj)-tmpVal)*arrMask(I,J-1,K,bi,bj)
74         &                               )
75              numPnts=numPnts+1              numPnts=numPnts+1
76                tmpVol = arrArea(I,J,bi,bj)*arrhFac(I,J,K,bi,bj)*arrDr(K)
77                theVol = theVol   + tmpVol
78                theMean = theMean + tmpVol*tmpVal
79                theVar = theVar   + tmpVol*tmpVal**2
80             ENDIF             ENDIF
81            ENDDO            ENDDO
82           ENDDO           ENDDO
# Line 70  C     === Local variables ==== Line 88  C     === Local variables ====
88        _GLOBAL_MAX_R8(theMin,myThid)        _GLOBAL_MAX_R8(theMin,myThid)
89        theMin=-theMin        theMin=-theMin
90        _GLOBAL_MAX_R8(theMax,myThid)        _GLOBAL_MAX_R8(theMax,myThid)
91          _GLOBAL_SUM_R8(theDel2,myThid)
92          _GLOBAL_SUM_R8(theVol,myThid)
93        _GLOBAL_SUM_R8(theMean,myThid)        _GLOBAL_SUM_R8(theMean,myThid)
94        _GLOBAL_SUM_R8(theVar,myThid)        _GLOBAL_SUM_R8(theVar,myThid)
95        tmpVal=FLOAT(numPnts)        tmpVal=FLOAT(numPnts)
# Line 78  C     === Local variables ==== Line 98  C     === Local variables ====
98    
99        IF (tmpVal.GT.0.) THEN        IF (tmpVal.GT.0.) THEN
100         rNumPnts=1./tmpVal         rNumPnts=1./tmpVal
101         theMean=theMean*rNumPnts         theDel2=theDel2*rNumPnts
102         theVar=theVar*rNumPnts        ENDIF
103    
104          IF (theVol.GT.0.) THEN
105           theMean=theMean/theVol
106           theVar=theVar/theVol
107    
108         DO bj=myByLo(myThid),myByHi(myThid)         DO bj=myByLo(myThid),myByHi(myThid)
109          DO bi=myBxLo(myThid),myBxHi(myThid)          DO bi=myBxLo(myThid),myBxHi(myThid)
# Line 87  C     === Local variables ==== Line 111  C     === Local variables ====
111            DO J=1,sNy            DO J=1,sNy
112             DO I=1,sNx             DO I=1,sNx
113              tmpVal=arr(I,J,K,bi,bj)              tmpVal=arr(I,J,K,bi,bj)
114              IF (tmpVal.NE.0.) THEN  c           IF (tmpVal.NE.0.) THEN
115               theSD=theSD+(tmpVal-theMean)**2              IF (arrMask(I,J,K,bi,bj).NE.0.) THEN
116                 tmpVol=arrArea(I,J,bi,bj)*arrhFac(I,J,K,bi,bj)*arrDr(K)
117                 theSD = theSD + tmpVol*(tmpVal-theMean)**2
118              ENDIF              ENDIF
119             ENDDO             ENDDO
120            ENDDO            ENDDO
# Line 98  C     === Local variables ==== Line 124  C     === Local variables ====
124    
125         _GLOBAL_SUM_R8(theSD,myThid)         _GLOBAL_SUM_R8(theSD,myThid)
126    
127         theSD=sqrt(theSD*rNumPnts)         theSD=sqrt(theSD/theVol)
128  c      theSD=sqrt(theVar-theMean**2)  c      theSD=sqrt(theVar-theMean**2)
129        ENDIF        ENDIF
130    

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

  ViewVC Help
Powered by ViewVC 1.1.22