- 积分
- 21
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2017-8-22
- 最后登录
- 1970-1-1
|
楼主 |
发表于 2019-9-29 20:54:37
|
显示全部楼层
代码为:
program ini_acc
use math
implicit none
character*40 file_name
double precision,allocatable :: q(:,:)
real ,allocatable :: acc(:),acc_save(:,:),acc_mean(:)
real ,allocatable :: rmse1(:),rmse_save(:,:),rmse_mean(:)
integer ,allocatable :: it(:)
integer :: numsteps
integer :: ens_size
integer :: cases
integer :: i,j,k
numsteps = 2920
ens_size = 2000
cases = 100
allocate(q(numsteps,ens_size),it(numsteps))
allocate(rmse1(numsteps),rmse_save(numsteps,cases),rmse_mean(numsteps))
allocate(acc(numsteps),acc_save(numsteps,cases),acc_mean(numsteps))
do i = 1 , cases
if (i < 10) then
write(file_name,31) 'out_q_',i
else if (i > 9 .and. i<100) then
write(file_name,32) 'out_q_',i
else
write(file_name,33) 'out_q_',i
end if
31 format(a6,i1)
32 format(a6,i2)
33 format(a6,i3)
open(11,file = 'F:\Visual Studio 2012\Projects\MOCBM_initial\MOCBM_initial\'//file_name, action='read')
do j = 1 , numsteps
read(11,41) it(j),q(j,:)
end do
41 format(i9, 1x, 2001(e12.4, 1x))
close(11)
!!!!!!!!caculate acc!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
do j = 2 , numsteps
call cof(q(1,:),q(j,:),ens_size,acc(j))
call rmse(q(1,:),q(j,:),ens_size,rmse1(j))
end do
acc(1) = 1
rmse1(1) = 1
!print*, acc(1:20)
!pause
acc_save(:,i) = acc(:)
rmse_save(:,i)= rmse1(:)
!print*, 'succeessful loop'
end do
acc_mean = sum(acc_save,dim=2)/cases
rmse_mean= sum(rmse_save,dim=2)/cases
print*, acc_mean(1:20)
pause
open(12,file='initial_acc.dat',status='replace',action='write',position='append')
open(13,file='initial_rmse.dat',status='replace',action='write',position='append')
do i = 1 , numsteps
write(12,42) acc_save(:,i)
end do
close (12)
do i = 1 , numsteps
write(13,42) rmse_save(:,i)
end do
42 format(100(e12.4,1x))
close(13)
end program ini_acc
|
|