[Fortran] 纯文本查看 复制代码
program composite
implicit none
external xigema
integer,parameter::con=192,xx=145,xy=37,year=64,k=64
real x(xx,xy,con),xb(xx,xy,year),xigema,xbb(xx,xy)
integer it,ix,iy,i
real jp1(k),jp2(k)
integer j1,j2,j3,j4,j5,j6,j7,j8,j9
real,allocatable::all_big(:,:,:),all_small(:,:,:),Ab_Is(:,:,:),As_Ib(:,:,:)
real,allocatable::As(:,:,:),Ab(:,:,:),Ib(:,:,:),Is(:,:,:),no(:,:,:)
open(10,file='d:\biye\pr.grd',form='binary')
do it=1,con
read(10)((x(ix,iy,it),ix=1,xx),iy=1,xy)
enddo
print*,'finish read 1'
!!!!!!!!!!!!!!!!!!!!!!求64年冬季平均!!!!!!!!!!!!!!!!!!
do iy=1,xy
do ix=1,xx
do it=1,con,3
xb(ix,iy,(it+2)/3)=(x(ix,iy,it)+x(ix,iy,it+1)+x(ix,iy,it+2))/3. !64年冬季平均
enddo
enddo
enddo
print*,'finish 64ave'
!!!!!!!!!!!!!!!!!!!!!样本平均!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
do iy=1,xy
do ix=1,xx
xbb(ix,iy)=xigema(xb(ix,iy,1:year),year)/year !样本总平均
enddo
enddo
print*,'finish all ave'
!!!!!!!!!!!!!!!!!!!!!选择年份放入特定数组!!!!!!!!!!!!!!!!!!!!!!!!!!
open(10,file='d:/biye/p1/pva1p.txt')
read(10,*)(jp1(i),i=1,k)
close(10)
open(11,file='d:/biye/p1/pvi1p.txt')
read(11,*)(jp2(i),i=1,k)
close(11)
j1=0;j2=0;j3=0;j4=0;j5=0;j6=0;j7=0;j8=0;j9=0
do i=1,k
if(jp1(i)>0.5.and.jp2(i)>0.5)then
j1=j1+1
allocate(all_big(xx,xy,j1))
all_big(xx,xy,j1)=xb(xx,xy,i)
else if(jp1(i)<-0.5.and.jp2(i)<-0.5)then
j2=j2+1
allocate(all_small(xx,xy,j2))
all_small(xx,xy,j2)=xb(xx,xy,i)
else if(jp1(i)>0.5.and.jp2(i)<-0.5)then
j3=j3+1
allocate(Ab_Is(xx,xy,j3))
Ab_Is(xx,xy,j3)=xb(xx,xy,i)
else if(jp1(i)<-0.5.and.jp2(i)>0.5)then
j4=j4+1
allocate(As_Ib(xx,xy,j4))
As_Ib(xx,xy,j4)=xb(xx,xy,i)
else if(jp1(i)<-0.5.and.-0.5<jp2(i)<0.5)then
j5=j5+1
!allocate(As(xx,xy,j5))!!!!!!!!!!!!!!!!!!!!!!!!!!出问题的地方
As(xx,xy,j5)=xb(xx,xy,i)
else if(jp1(i)>0.5.and.-0.5<jp2(i)<0.5)then
j6=j6+1
allocate(Ab(xx,xy,j6))
Ab(xx,xy,j6)=xb(xx,xy,i)
else if(-0.5<jp1(i)<0.5.and.jp2(i)<-0.5)then
j7=j7+1
allocate(Is(xx,xy,j7))
Is(xx,xy,j7)=xb(xx,xy,i)
else if(-0.5<jp1(i)<0.5.and.jp2(i)>0.5)then
j8=j8+1
allocate(Ib(xx,xy,j8))
Ib(xx,xy,j8)=xb(xx,xy,i)
else
j9=j9+1
allocate(no(xx,xy,j9))
no(xx,xy,j9)=xb(xx,xy,i)
endif
enddo
write(*,*)j1,j2,j3,j4,j5,j6,j7,j8,j9
!deallocate(all_big(:,:,:),all_small(:,:,:),Ab_Is(:,:,:),As_Ib(:,:,:)&
! &As(:,:,:),Ab(:,:,:),Ib(:,:,:),Is(:,:,:),no(:,:,:))
print*,'finish choose'
pause
end