- 积分
- 99
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2017-5-4
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
program tem_select
implicit none
! define vars --- {{{1
character(len=100), parameter :: path_in ="/lunwen/TEM/sp-winter-hebing/", &
path_inn = "/lunwen1/sp-sst/",path_out="/lunwen1/sp-winter-t/"
character(len=100) :: st,line
real ::sum,summ,stt,sttt,sum1,summ1,aver,averr,t
integer :: nums, end_num, num=0,num_,num1=0,io
integer :: i, j, k, w,undef = 32766
real::datain(100),datainn(200)
integer, dimension(:), allocatable :: sta
real, dimension(:), allocatable :: lat, lon, h
! ---}}}
! read station formation --- {{{1
open(12, file=trim(path_inn)//'sp-Nino.txt', status='old')
do j=1,300
read(12,*,iostat=io) line
if(io<0)exit
num1=num1+1
read(line,*)datainn(num1)
enddo
close(12)
open(11,file=trim(path_in)//"station-selected.txt", status="old")
read(11,*)
nums = 0
loop1 : &
do
read(11,*,iostat=end_num)
if(end_num==0)then
nums = nums + 1
else
exit loop1
end if
end do loop1
print*,"the number of station:", nums
!
rewind(11)
allocate(sta(nums),lat(nums),lon(nums))
read(11,*)
do k = 1, nums
read(11,*) sta(k), lat(k), lon(k)
end do
close(11)
! ---}}}
! read & write temperature data --- {{{1
do i=1,nums
num=num-num
print*, i, sta(i)
write(st,'(i5)') sta(i)
open(11, file=trim(path_in)//trim(st)//'.txt', status='old')
do j=1,200
read(11,*,iostat=io) line
if(io<0)exit
num=num+1
read(line,*)datain(num)
enddo
close(11)
open(13, file=trim(path_out)//trim(st)//'.txt', status='old')
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1
sum=0.0
do t=1,num
sum=sum+datain(t)
end do
!print*,sum
aver=sum/num
print*,aver
summ=0.0
do t=1,num1
summ=summ+datainn(t)
end do
averr=summ/num1
print*,averr
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
sum1=0.0
do t=1,num
sum1=sum1+((datain(t)-aver)**2)
end do
stt=sqrt(sum1/num)
print*,stt
summ1=0.0
do t=1,num1
summ1=summ1+((datainn(t)-averr)**2)
end do
sttt=sqrt(summ1/num1)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
t=(aver-averr)/sqrt(((((num-1)*stt**2+(num1-1)*sttt**2)/(num1+num-2))*1.0)*sqrt((1/num+1/num1)*1.0))
write(13,55)t
55 format(f9.5)
end do
end program
该编码是用来算差值t检验,问题是出现在输出结果,程序是没问题的,结果出现infinity,而我已经定义了输出格式,可能有些小细节没注意到,z
|
|