- 积分
- 3345
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2014-12-5
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
program main
parameter(n=52,mx=171,my=42,m=7182,mnl=n,ll=7182,np=10)
parameter(ks=1,undef=32767.0)
!-----input array
dimension f0(m,n)
!-----work array
dimension f(ll,n),gvt(ll,mnl),rgvt(ll,np),cof(mnl,n),rcof(np,n)
!-----output arrays
dimension er(mnl,4),egvt(m,mnl),ecof(mnl,n)
dimension rer(np,2),regvt(m,np),recof(np,n)
c-----read data
open(17,file='f:/wwt/kaoep/tiqu.grd',form='binary')
do j=1,n
read(17)(f0(i,j),i=1,m)
end do
close(17)
write(*,*)'read data ok'
c-----Remove the terrain or missing value.
l=0
do j=1,m
if(f0(j,1).ne.undef)then
l=l+1
do k=1,n
f(l,k)=f0(j,k)
enddo
endif
enddo
write(*,*)'ll=',l
c-----call the subroutine
call reof(ll,n,mnl,np,f,ks,er,gvt,ecof,rer,rgvt,recof)
c-----Add the terrain or missing value.
l=0
do i=1,m
if(f0(i,1).ne.undef)then
l=l+1
do k=1,n
egvt(i,k)=gvt(l,k)
end do
do k=1,np
regvt(i,k)=rgvt(l,k)
end do
else
do k=1,n
egvt(i,k)=undef
end do
do k=1,np
regvt(i,k)=undef
end do
endif
enddo
!-----output the result
c-----output the error
OPEN(10,file='f:/wwt/kaoep/eof/er.txt',status='unknown')
write(10,*)'EOF lanmda (eigenvalues) from big to small'
write(10,*)(er(i,1),i=1,mnl)
write(*,*)'lamda='
write(*,*)(er(i,1),i=1,mnl)
write(10,*)'EOF accumulated eigenvalues from big to small'
write(10,*)(er(i,2),i=1,mnl)
write(10,*)'EOF explained variances'
write(10,*)(er(i,3),i=1,mnl)
write(10,*)'EOF accumulated explained variances'
write(10,*)(er(i,4),i=1,mnl)
write(10,*)'REOF explained variances'
write(10,*)(rer(i,1),i=1,np)
write(10,*)'REOF accumulated explained variances'
write(10,*)(rer(i,2),i=1,np)
c-----output eigenvactors matrix of EOF
OPEN(11,FILE='f:/wwt/kaoep/eof/egv.grd',form='binary')
do j=1,mnl
write(11)(egvt(i,j),i=1,m)
end do
close(11)
c-----output time coefficients matrix of EOF
OPEN(14,FILE='f:/wwt/kaoep/eof/ecof.grd',form='binary')
do j=1,n
write(14)(ecof(i,j),i=1,mnl)
! open(14,file='ecof.txt')
! do j=1,n
! write(14,"(33f20.6)")(ecof(i,j),i=1,mnl)
end do
close(14)
c-----output loading vectors of REOF
OPEN(21,FILE='f:/wwt/kaoep/eof/regv.grd',form='binary')
do j=1,np
write(21)(regvt(i,j),i=1,m)
end do
close(21)
c-----output time coefficients matrix of REOF
OPEN(22,FILE='f:/wwt/kaoep/eof/recof.grd',form='binary')
do j=1,n
write(22)(recof(i,j),i=1,np)
end do
close(22)
stop
end
program main
parameter(n=52,mx=171,my=42,m=7182,mnl=n,ll=7182,np=10)
parameter(ks=1,undef=32767.0)
!-----input array
dimension f0(m,n)
!-----work array
dimension f(ll,n),gvt(ll,mnl),rgvt(ll,np),cof(mnl,n),rcof(np,n)
!-----output arrays
dimension er(mnl,4),egvt(m,mnl),ecof(mnl,n)
dimension rer(np,2),regvt(m,np),recof(np,n)
c-----read data
open(17,file='f:/wwt/kaoep/tiqu.grd',form='binary')
do j=1,n
read(17)(f0(i,j),i=1,m)
end do
close(17)
write(*,*)'read data ok'
c-----Remove the terrain or missing value.
l=0
do j=1,m
if(f0(j,1).ne.undef)then
l=l+1
do k=1,n
f(l,k)=f0(j,k)
enddo
endif
enddo
write(*,*)'ll=',l
c-----call the subroutine
call reof(ll,n,mnl,np,f,ks,er,gvt,ecof,rer,rgvt,recof)
c-----Add the terrain or missing value.
l=0
do i=1,m
if(f0(i,1).ne.undef)then
l=l+1
do k=1,n
egvt(i,k)=gvt(l,k)
end do
do k=1,np
regvt(i,k)=rgvt(l,k)
end do
else
do k=1,n
egvt(i,k)=undef
end do
do k=1,np
regvt(i,k)=undef
end do
endif
enddo
!-----output the result
c-----output the error
OPEN(10,file='f:/wwt/kaoep/eof/er.txt',status='unknown')
write(10,*)'EOF lanmda (eigenvalues) from big to small'
write(10,*)(er(i,1),i=1,mnl)
write(*,*)'lamda='
write(*,*)(er(i,1),i=1,mnl)
write(10,*)'EOF accumulated eigenvalues from big to small'
write(10,*)(er(i,2),i=1,mnl)
write(10,*)'EOF explained variances'
write(10,*)(er(i,3),i=1,mnl)
write(10,*)'EOF accumulated explained variances'
write(10,*)(er(i,4),i=1,mnl)
write(10,*)'REOF explained variances'
write(10,*)(rer(i,1),i=1,np)
write(10,*)'REOF accumulated explained variances'
write(10,*)(rer(i,2),i=1,np)
c-----output eigenvactors matrix of EOF
OPEN(11,FILE='f:/wwt/kaoep/eof/egv.grd',form='binary')
do j=1,mnl
write(11)(egvt(i,j),i=1,m)
end do
close(11)
c-----output time coefficients matrix of EOF
OPEN(14,FILE='f:/wwt/kaoep/eof/ecof.grd',form='binary')
do j=1,n
write(14)(ecof(i,j),i=1,mnl)
! open(14,file='ecof.txt')
! do j=1,n
! write(14,"(33f20.6)")(ecof(i,j),i=1,mnl)
end do
close(14)
c-----output loading vectors of REOF
OPEN(21,FILE='f:/wwt/kaoep/eof/regv.grd',form='binary')
do j=1,np
write(21)(regvt(i,j),i=1,m)
end do
close(21)
c-----output time coefficients matrix of REOF
OPEN(22,FILE='f:/wwt/kaoep/eof/recof.grd',form='binary')
do j=1,n
write(22)(recof(i,j),i=1,np)
end do
close(22)
stop
end
|
|