- 积分
- 160
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2018-8-3
- 最后登录
- 1970-1-1
|
发表于 2018-9-20 15:58:00
|
显示全部楼层
我有一个程序,但是我不知道怎么改?
PROGRAM main
IMPLICIT NONE
INTEGER,parameter::m=261,n=121
!m为经向格点数
REAL,DIMENSION(24)::U(M,N),v(m,n)
real::hour,f_min,f_miao
INTEGER::I,J,L,K,z,IREC,STAT,year,month,date,all_date,n_hour
CHARACTER(LEN=20)::FILENAME,f_time
OPEN(10,FILE='result.dat',form='formatted')
OPEN(20,FILE='result_2.dat',form='unformatted',access='direct',recl=m*n)
IREC=0
DO year=2011,2011
DO month=12,12
if(month==1.or.month==3.or.month==5.or.month==7.or.month==8.or.month==10.or.month==12)then
all_date=31
elseif(month==2)then
if(mod(year,4)==0)then
all_date=29
else
all_date=28
endif
else
all_date=30
endif
DO date=1,all_date
WRITE(UNIT=FILENAME,FMT="(I8,'.dat')")10000*year+100*month+date
PRINT*,"正在操作文件:",FILENAME
PRINT*,"等哈哈儿啊,坐嘛:-)"
open(30,file=FILENAME,form='unformatted',access='direct',recl=m*n)
do 200 n_hour=1,4
hour=(n_hour-1)*6.
F_time(1:1)=char(mod(int(hour/10),10)+48)
F_time(2:2)=char(mod(int(hour),10)+48)
f_min=(hour-int(hour))*60
f_miao=(f_min-int(f_min))*60
F_time(3:3)=char(mod(int(f_min/10),10)+48)
F_time(4:4)=char(mod(int(f_min),10)+48)
F_time(5:5)=char(mod(int(f_miao/10),10)+48)
F_time(6:6)=char(mod(int(f_miao),10)+48)
read(30,rec=2*n_hour-1)U !((u(i,j),j=1,n),i=1,m)
read(30,rec=2*n_hour)v
write(10,'(i8," ",a6)')10000*year+100*month+date,F_time(1:6)
do j=1,n
write(10,'(<m>f11.3)') (u(i,j),i=1,m)
enddo
do j=1,n
write(10,'(<m>f11.3)') (v(i,j),i=1,m)
enddo
WRITE(20,REC=2*IREC+1)U
WRITE(20,REC=2*IREC+2)v
irec=irec+1
200 continue
100 close(30)
! PRINT*,"文件矩阵数:",IREC-1
PRINT*,"哈哈,小子,该读下一个文件了^_^"
PRINT*," "
ENDDO
ENDDO
enddo
PRINT*," "
PRINT*,"没了???日! "
CLOSE(10)
CLOSE(20)
PRINT*,"哈哈,搞定了,^_^"
! PRINT*,'总数:',IREC
END PROGRAM |
|