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
1.png (54.24 KB, 下载次数: 279)
date.txt文件
8.png (171.83 KB, 下载次数: 273)
要读取的文件
QQ截图20160618101735.jpg (43.87 KB, 下载次数: 256)
欢迎光临 Fortran Coder (http://bbs.fcode.cn/) | Powered by Discuz! X3.2 |