-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStatistic.f90
203 lines (203 loc) · 6.01 KB
/
Statistic.f90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
subroutine StatGrd3D(grid,row,col,nn,rst)
!-------------------------------------------------------------
implicit none
integer::row,col,nn,i,j,k,kk
real*8::grid(row,col,nn),rst(4),maxt,mint,pv,err,fr
!-----------------------------------------------------------------------
pv=0.d0;err=0.d0;maxt=-9.d28;mint=9.d28
fr=dble(row*col*nn);kk=0
do k=1,nn
do i=1,row
do j=1,col
if(grid(i,j,k)>9000.d0)goto 1001
kk=kk+1;pv=pv+grid(i,j,k)/fr
if(maxt<grid(i,j,k))maxt=grid(i,j,k)
if(mint>grid(i,j,k))mint=grid(i,j,k)
1001 continue
enddo
enddo
enddo
pv=pv/dble(kk)*fr
do k=1,nn
do i=1,row
do j=1,col
if(grid(i,j,k)>9000.d0)goto 1002
err=err+(grid(i,j,k)-pv)**2/dble(kk)
1002 continue
enddo
enddo
enddo
err=dsqrt(err)
rst(1)=pv; rst(2)=err; rst(3)=mint;rst(4)=maxt
return
end
!******************************************************************
subroutine Stat1d0(dt,nn,rst)
implicit none
integer::nn,i
real*8::dt(nn),rst(4),pv,std,maxt,mint
!---------------------------------------------------------------------
pv=0.d0;std=0.d0;maxt=-9.d28;mint=9.d28
do i=1,nn
pv=pv+dt(i)
if(maxt<dt(i))maxt=dt(i)
if(mint>dt(i))mint=dt(i)
enddo
pv=pv/dble(nn)
do i=1,nn
std=std+dt(i)**2
enddo
std=sqrt(std/dble(nn))
rst(1)=pv;rst(2)=std;rst(3)=mint;rst(4)=maxt
end
!******************************************************************
subroutine Stat1dnonzero(dt,nn,rst)
implicit none
integer::nn,i,kk
real*8::dt(nn),rst(4),pv,std,maxt,mint
!---------------------------------------------------------------------
pv=0.d0;std=0.d0;maxt=-9.d28;mint=9.d28
kk=0
do i=1,nn
if(dt(i)>9900.d0.or.dabs(dt(i))<1.d-20)goto 1001
kk=kk+1;pv=pv+dt(i)
if(maxt<dt(i))maxt=dt(i)
if(mint>dt(i))mint=dt(i)
1001 continue
enddo
pv=pv/dble(kk)
do i=1,nn
if(dt(i)>9900.d0)goto 1002
std=std+(dt(i)-pv)**2
1002 continue
enddo
std=dsqrt(std/dble(kk))
rst(1)=pv;rst(2)=std;rst(3)=mint;rst(4)=maxt
end
!******************************************************************
subroutine Stat1d(dt,nn,rst)
implicit none
integer::nn,i,kk
real*8::dt(nn),rst(4),pv,std,maxt,mint
!---------------------------------------------------------------------
pv=0.d0;std=0.d0;maxt=-9.d28;mint=9.d28
kk=0
do i=1,nn
if(dt(i)>9.d5)goto 1001
kk=kk+1;pv=pv+dt(i)/dble(nn)
if(maxt<dt(i))maxt=dt(i)
if(mint>dt(i))mint=dt(i)
1001 continue
enddo
if(kk<1)then
rst=0.d0;return
endif
pv=pv/dble(kk)*dble(nn)
do i=1,nn
if(dt(i)>9.d5)goto 1002
std=std+(dt(i)-pv)**2/dble(kk)
1002 continue
enddo
std=dsqrt(std)
rst(1)=pv;rst(2)=std;rst(3)=mint;rst(4)=maxt
if(isnan(rst(1)))then
continue
endif
end
!******************************************************************
subroutine Stat1d1(dt,nn,rst)
implicit none
integer::nn,i,kk
real*8::dt(nn),rst(4),pv,std,maxt,mint
!---------------------------------------------------------------------
pv=0.d0;std=0.d0;maxt=-9.d28;mint=9.d28
kk=0
do i=1,nn
kk=kk+1;pv=pv+dt(i)
if(maxt<dt(i))maxt=dt(i)
if(mint>dt(i))mint=dt(i)
enddo
pv=pv/dble(kk)
do i=1,nn
std=std+(dt(i)-pv)**2
enddo
std=dsqrt(std/dble(kk))
rst(1)=pv;rst(2)=std;rst(3)=mint;rst(4)=maxt
end
!
!******************************************************************
subroutine StatGrid(grid,row,col,rst)
!-------------------------------------------------------------
implicit none
integer::row,col,i,j,kk
real*8::grid(row,col),rst(4),maxt,mint,pv,err,fr
!-----------------------------------------------------------------------
pv=0.d0;err=0.d0;maxt=-9.d28;mint=9.d28
fr=dble(row*col);kk=0
do i=1,row
do j=1,col
if(grid(i,j)>9000.d0)goto 1001
kk=kk+1;pv=pv+grid(i,j)/fr
if(maxt<grid(i,j))maxt=grid(i,j)
if(mint>grid(i,j))mint=grid(i,j)
1001 continue
enddo
enddo
pv=pv/dble(kk)*fr
do i=1,row
do j=1,col
if(grid(i,j)>9000.d0)goto 1002
err=err+(grid(i,j)-pv)**2/dble(kk)
1002 continue
enddo
enddo
err=dsqrt(err)
rst(1)=pv; rst(2)=err; rst(3)=mint;rst(4)=maxt
return
end
!******************************************************************
subroutine Statvect(v1,v2,row,col,rst)
!-------------------------------------------------------------
implicit none
integer::row,col,i,j,kk
real*8::v1(row,col),v2(row,col),rst(4),maxt,mint,pv,err,fr
!-----------------------------------------------------------------------
pv=0.d0;err=0.d0;maxt=-9.d28;mint=9.d28
fr=dble(row*col);kk=0
do i=1,row
do j=1,col
if(v1(i,j)>9000.d0)goto 1001
kk=kk+1;pv=pv+v1(i,j)/fr
if(maxt<v1(i,j))maxt=v1(i,j)
if(mint>v1(i,j))mint=v1(i,j)
1001 continue
enddo
enddo
do i=1,row
do j=1,col
if(v2(i,j)>9000.d0)goto 2001
kk=kk+1;pv=pv+v2(i,j)/fr
if(maxt<v2(i,j))maxt=v2(i,j)
if(mint>v2(i,j))mint=v2(i,j)
2001 continue
enddo
enddo
pv=pv/dble(kk)*fr/2.d0
do i=1,row
do j=1,col
if(v1(i,j)>9000.d0)goto 1002
err=err+(v1(i,j)-pv)**2/dble(kk)
1002 continue
enddo
enddo
do i=1,row
do j=1,col
if(v2(i,j)>9000.d0)goto 2002
err=err+(v2(i,j)-pv)**2/dble(kk)
2002 continue
enddo
enddo
err=dsqrt(err)
rst(1)=pv; rst(2)=err; rst(3)=mint;rst(4)=maxt
return
end