现在我要读取循环predict文件,用时间文件date作为读文件的路径一部分,并用时间文件控制要读哪个文件,我调用下面的程序能输出outputfile1(j),outputfile2(j)实现吗?代码如下: 谢谢老师!
[Fortran] 纯文本查看 复制代码
subroutine timefileprepare(Began_time,finish_time,deltminute,outputfile1,outputfile2,sizeoffile,totaltime)
integer Began_time,finish_time,deltminute,totaltime
integer datelength,sizeoffile
integer minutestep,hourstep,tempint
character(90) date1char,date2char,timechar,temp_char !(sizeoffile)
character outputfile1(4300),outputfile2(4300)
integer dateofile(25000)
integer date1,date2,time
integer TIMELENGH
!________截取时间段_____________________
open(11,file="date.txt")
i=0
do while(.not.eof(11))
i=i+1
read(11,*) dateofile(i)
enddo
!do i=1,4246
! read(11,*) dateofile(i)
! enddo
close(11)
TIMELENGH=4246
minutestep=deltminute
j=0
do i=1,TIMELENGH
if (((dateofile(i)).GE.(Began_time)).and.((dateofile(i)).LE.(finish_time))) then
j=j+1
! k=j
date1=int(dateofile(i)/10000)+2*10**7 !20150427 适用于实际降水文件
date2=int(dateofile(i)/10000)+2*10**7+2*10**9 !2020150427 适用于预报文件
time=dateofile(i)-int(dateofile(i)/10000)*10000 !10000
if(time.LE.1000) then
write(temp_char,"(I4)") time
timechar="0"//trim(temp_char)
end if
write(timechar,"(I4)") time ! 0730
write(date1char,"(I8)") date1 !20150427
write(date2char,"(I10)") date2 !2020150427
outputfile1(j)=trim(date1char)//"_"//trim(timechar(2:5)) !20150427_0730
outputfile2(j)=trim(date2char)//"_"//trim(timechar(2:5)) !2020150427_0730
end if
end do
|