本帖最后由 是来来啊 于 2020-4-1 15:20 编辑
附上程序
[Fortran] 纯文本查看 复制代码 program main
integer ist,dd
parameter(ist=50,dd=12)
dimension cor(ist)
character*8 istid(ist)
real istr(ist),istr19(ist,dd)
! ---------------读实况值 istr(i)
open(20,file='F:\shuju\sk_06R.txt')
do i=1,ist
read(20,*)
enddo
close(20)
! ---------------读预报值 istr19(i,j)
open(20,file='F:\shuju\ms_06R_26.txt')
do i=1,50
read(20,*)(istr19(i,j),j=1,dd)
enddo
close(20)
open(2,file='F:\shuju\result\ACC_06R.txt') !!!!输出ACC文件
do j=1,ist
write(2,'(I5,2x,<6>(f10.3,2X))')cor(j)
enddo
close(2)
end
Subroutine cor(x,y,n,coefficient)
dimension x(n),y(n)
real coefficient,avex,avey,sum1,sum2
sum1=0.0;sum2=0.0
do i=1,n
sum1=x(i)+sum1
sum2=y(i)+sum2
enddo
avex=sum1/n;avey=sum2/n
sum1=0.0;sum2=0.0;sum3=0.0
do j=1,n
sum1=sum1+(x(j)-avex)*(y(j)-avey)
sum2=sum2+(x(j)-avex)**2
sum3=sum3+(y(j)-avey)**2
enddo
coefficient=sum1/sqrt(sum2*sum3)
return
end |