- 积分
- 31
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2014-4-23
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
program Console2
!default parameters
integer,parameter ::yrbegin=2001,yrend=2099,nx=72,ny=46,nz=17,nt=99
!recycle varable
integer year,t,z
character(len=40) yr(99),file_end1,file_end2,file_head
!array to read data
real v1(nx,ny,nz,nt),v7(nx,ny,nz,nt)
!array to restore average of and V
real ave_v1(nx,ny,nz),ave_v7(nx,ny,nz)
!file name at the end
file_end1="-01.grd"
file_end2="-07.grd"
file_head='V'
!to reverse the int_var to the char_var
do year=yrbegin,yrend
write(yr(year-yrbegin+1) , "(I4)" ) year
end do
!just to read V1 ,V7 data from every file
do t=1,nt
open(11,file='d:/lunwen/1yuegrd/'//trim(adjustl(file_head))//trim(adjustl(yr(t)))//trim(adjustl(file_end1)),form='binary')
open(12,file='d:/lunwen/7yuegrd/'//trim(adjustl(file_head))//trim(adjustl(yr(t)))//trim(adjustl(file_end2)),form='binary')
read(11)(((v1(i,j,z,t),i=1,nx),j=1,ny),z=1,nz)
read(12)(((v7(i,j,z,t),i=1,nx),j=1,ny),z=1,nz)
close(11)
close(12)
end do
!this is the compution setion , to calculate the average feild of u, v of Jan and Jul
do i=1,nx;do j=1,ny;do z=1,nz
ave_v1(i,j,z)=sum(v1(i,j,z,:))/nt;ave_v7(i,j,z)=sum(v7(i,j,z,:))/nt
end do;end do;end do
!ok,to write the results to the hard disk
open(22,file='d:/lunwen/v1.grd',form='binary')
open(23,file='d:/lunwen/v7.grd',form='binary')
write(22)(((ave_v1(i,j,z),i=1,nx),j=1,ny),z=1,nz);write(23)(((ave_v7(i,j,z),i=1,nx),j=1,ny),z=1,nz)
close(22)
close(23)
stop
end program
这是程序,运行结果显示提示为:forrt1:severe(24): end-of-file during read,unit 11,file d:\lunwen\1yuegrad\V2001-01.grd
|
|