9 |
|
|
10 |
C !INTERFACE: |
C !INTERFACE: |
11 |
SUBROUTINE MON_STATS_RL( |
SUBROUTINE MON_STATS_RL( |
12 |
I myNr, arr, arrMask,arrhFac, arrArea, arrDr, |
I myNr, arr, |
13 |
O theMin,theMax,theMean,theSD,theDel2,theVol, |
O theMin,theMax,theMean,theSD, |
14 |
I myThid ) |
I myThid ) |
15 |
|
|
16 |
|
C !DESCRIPTION: |
17 |
C Calculate bare statistics of global array ``\_RL arr''. |
C Calculate bare statistics of global array ``\_RL arr''. |
18 |
|
|
19 |
C !USES: |
C !USES: |
24 |
C !INPUT PARAMETERS: |
C !INPUT PARAMETERS: |
25 |
INTEGER myNr |
INTEGER myNr |
26 |
_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) |
27 |
_RS arrMask(1-OLx:sNx+OLx,1-OLy:sNy+OLy,myNr,nSx,nSy) |
_RL theMin, theMax, theMean, theSD |
|
_RS arrhFac(1-OLx:sNx+OLx,1-OLy:sNy+OLy,myNr,nSx,nSy) |
|
|
_RS arrArea(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
|
|
_RS arrDr(myNr) |
|
|
_RL theMin, theMax, theMean, theSD, theDel2, theVol |
|
28 |
INTEGER myThid |
INTEGER myThid |
29 |
CEOP |
CEOP |
30 |
|
|
33 |
INTEGER numPnts |
INTEGER numPnts |
34 |
LOGICAL noPnts |
LOGICAL noPnts |
35 |
_RL tmpVal,rNumPnts |
_RL tmpVal,rNumPnts |
36 |
_RL theVar,theVarTile |
_RL theVar |
37 |
_RL tmpVol |
_RL tileMean(nSx,nSy) |
38 |
_RL theMeanTile, theSDTile, theDel2Tile, theVolTile |
_RL tileVar (nSx,nSy) |
39 |
|
_RL tileSD (nSx,nSy) |
40 |
theMin=0. |
|
41 |
theMax=0. |
theMin = 0. |
42 |
theMean=0. |
theMax = 0. |
43 |
theSD=0. |
theMean= 0. |
44 |
theVar=0. |
theSD = 0. |
45 |
theDel2=0. |
theVar = 0. |
46 |
theVol=0. |
numPnts= 0 |
47 |
numPnts=0 |
noPnts = .TRUE. |
|
noPnts=.TRUE. |
|
48 |
|
|
49 |
DO bj=myByLo(myThid),myByHi(myThid) |
DO bj=myByLo(myThid),myByHi(myThid) |
50 |
DO bi=myBxLo(myThid),myBxHi(myThid) |
DO bi=myBxLo(myThid),myBxHi(myThid) |
51 |
theDel2Tile = 0. |
tileMean(bi,bj) = 0. |
52 |
theVolTile = 0. |
tileVar (bi,bj) = 0. |
|
theMeanTile = 0. |
|
|
theVarTile = 0. |
|
53 |
DO K=1,myNr |
DO K=1,myNr |
54 |
DO J=1,sNy |
DO J=1,sNy |
55 |
DO I=1,sNx |
DO I=1,sNx |
56 |
tmpVal=arr(I,J,K,bi,bj) |
tmpVal=arr(I,J,K,bi,bj) |
57 |
IF (arrMask(I,J,K,bi,bj).NE.0. .AND. noPnts) THEN |
c IF (tmpVal.NE.0. .AND. noPnts) THEN |
58 |
theMin=tmpVal |
IF ( noPnts ) THEN |
59 |
theMax=tmpVal |
theMin = tmpVal |
60 |
noPnts=.FALSE. |
theMax = tmpVal |
61 |
|
noPnts = .FALSE. |
62 |
ENDIF |
ENDIF |
63 |
IF (arrMask(I,J,K,bi,bj).NE.0.) THEN |
c IF (tmpVal.NE.0.) THEN |
64 |
theMin=min(theMin,tmpVal) |
theMin = MIN(theMin,tmpVal) |
65 |
theMax=max(theMax,tmpVal) |
theMax = MAX(theMax,tmpVal) |
66 |
theDel2Tile = theDel2Tile+0.25*ABS( |
tileMean(bi,bj)=tileMean(bi,bj)+tmpVal |
67 |
& (arr(I+1,J,K,bi,bj)-tmpVal)*arrMask(I+1,J,K,bi,bj) |
tileVar (bi,bj)=tileVar (bi,bj)+tmpVal*tmpVal |
|
& +(arr(I-1,J,K,bi,bj)-tmpVal)*arrMask(I-1,J,K,bi,bj) |
|
|
& +(arr(I,J+1,K,bi,bj)-tmpVal)*arrMask(I,J+1,K,bi,bj) |
|
|
& +(arr(I,J-1,K,bi,bj)-tmpVal)*arrMask(I,J-1,K,bi,bj) |
|
|
& ) |
|
68 |
numPnts=numPnts+1 |
numPnts=numPnts+1 |
69 |
tmpVol = arrArea(I,J,bi,bj)*arrhFac(I,J,K,bi,bj)*arrDr(K) |
c ENDIF |
|
& *arrMask(I,J,K,bi,bj) |
|
|
theVolTile = theVolTile + tmpVol |
|
|
theMeanTile = theMeanTile + tmpVol*tmpVal |
|
|
theVarTile = theVarTile + tmpVol*tmpVal*tmpVal |
|
|
ENDIF |
|
70 |
ENDDO |
ENDDO |
71 |
ENDDO |
ENDDO |
72 |
ENDDO |
ENDDO |
73 |
theDel2 = theDel2 + theDel2Tile |
c theMean=theMean+tileMean(bi,bj) |
74 |
theVol = theVol + theVolTile |
c theVar =theVar +tileVar (bi,bj) |
|
theMean = theMean + theMeanTile |
|
|
theVar = theVar + theVarTile |
|
75 |
ENDDO |
ENDDO |
76 |
ENDDO |
ENDDO |
77 |
|
|
78 |
_GLOBAL_SUM_R8(theDel2,myThid) |
c _GLOBAL_SUM_RL(theMean,myThid) |
79 |
_GLOBAL_SUM_R8(theVol,myThid) |
c _GLOBAL_SUM_RL(theVar,myThid) |
80 |
_GLOBAL_SUM_R8(theMean,myThid) |
CALL GLOBAL_SUM_TILE_RL( tileMean, theMean, myThid ) |
81 |
_GLOBAL_SUM_R8(theVar,myThid) |
CALL GLOBAL_SUM_TILE_RL( tileVar , theVar , myThid ) |
82 |
tmpVal=FLOAT(numPnts) |
tmpVal=FLOAT(numPnts) |
83 |
_GLOBAL_SUM_R8(tmpVal,myThid) |
_GLOBAL_SUM_RL(tmpVal,myThid) |
84 |
numPnts=NINT(tmpVal) |
numPnts=NINT(tmpVal) |
85 |
|
|
86 |
IF (tmpVal.GT.0.) THEN |
IF (tmpVal.GT.0.) THEN |
87 |
rNumPnts=1. _d 0/tmpVal |
rNumPnts=1. _d 0/tmpVal |
88 |
theDel2=theDel2*rNumPnts |
theMean=theMean*rNumPnts |
89 |
ENDIF |
theVar=theVar*rNumPnts |
|
|
|
|
IF (theVol.GT.0.) THEN |
|
|
theMean=theMean/theVol |
|
|
theVar=theVar/theVol |
|
90 |
IF ( noPnts ) theMin = theMean |
IF ( noPnts ) theMin = theMean |
91 |
theMin=-theMin |
theMin=-theMin |
92 |
_GLOBAL_MAX_R8(theMin,myThid) |
_GLOBAL_MAX_RL(theMin,myThid) |
93 |
theMin=-theMin |
theMin=-theMin |
94 |
IF ( noPnts ) theMax = theMean |
IF ( noPnts ) theMax = theMean |
95 |
_GLOBAL_MAX_R8(theMax,myThid) |
_GLOBAL_MAX_RL(theMax,myThid) |
96 |
|
|
97 |
DO bj=myByLo(myThid),myByHi(myThid) |
DO bj=myByLo(myThid),myByHi(myThid) |
98 |
DO bi=myBxLo(myThid),myBxHi(myThid) |
DO bi=myBxLo(myThid),myBxHi(myThid) |
99 |
theSDtile=0. |
tileSD(bi,bj)=0. |
100 |
DO K=1,myNr |
DO K=1,myNr |
101 |
DO J=1,sNy |
DO J=1,sNy |
102 |
DO I=1,sNx |
DO I=1,sNx |
103 |
tmpVal=arr(I,J,K,bi,bj) |
tmpVal=arr(I,J,K,bi,bj) |
104 |
c IF (tmpVal.NE.0.) THEN |
c IF (tmpVal.NE.0.) THEN |
105 |
IF (arrMask(I,J,K,bi,bj).NE.0.) THEN |
tileSD(bi,bj) = tileSD(bi,bj) |
106 |
tmpVol=arrArea(I,J,bi,bj)*arrhFac(I,J,K,bi,bj)*arrDr(K) |
& + (tmpVal-theMean)*(tmpVal-theMean) |
107 |
& *arrMask(I,J,K,bi,bj) |
c ENDIF |
|
theSDtile = theSDtile + tmpVol*(tmpVal-theMean)**2 |
|
|
ENDIF |
|
108 |
ENDDO |
ENDDO |
109 |
ENDDO |
ENDDO |
110 |
ENDDO |
ENDDO |
111 |
theSD = theSD + theSDtile |
c theSD = theSD + tileSD(bi,bj) |
112 |
ENDDO |
ENDDO |
113 |
ENDDO |
ENDDO |
114 |
|
|
115 |
_GLOBAL_SUM_R8(theSD,myThid) |
c _GLOBAL_SUM_RL(theSD,myThid) |
116 |
|
CALL GLOBAL_SUM_TILE_RL( tileSD, theSD, myThid ) |
117 |
|
|
118 |
theSD=sqrt(theSD/theVol) |
theSD = SQRT(theSD*rNumPnts) |
119 |
c theSD=sqrt(theVar-theMean**2) |
c theSD = SQRT(theVar-theMean*theMean) |
120 |
ENDIF |
ENDIF |
121 |
|
|
122 |
RETURN |
RETURN |