program getdata
implicit none
integer::I,J,K,N,M
character(len=20)::fname
character(len=100)::path
real::hmax
real,dimension(30)::hh
real,dimension(30,730)::h,tub,tt
real,dimension(30)::ht,tubt,ttt
open(11,file="name.txt",status="old")
open(13,file="WT.csv")
open(14,file="TURB.csv")
hmax=0.0
do I=0,28
hh(I+1)=120.0+i*0.5
enddo
write(13,*)"天数","時間"
write(13,"(I5,',',I5,',',29(f5.1,','))")1,9,(hh(I),I=1,29)
write(14,*)"天数","時間"
write(14,"(I5,',',I5,',',29(f5.1,','))")2,9,(hh(I),I=1,29)
I=0
h=-999.0
tub=-999.0
tt=-999.0
ht=-999.0
tubt=-999.0
ttt=-999.0
do
read(11,*,end=30)fname
write(*,*)fname
path='mkinput\'//trim(fname)
write(*,*)trim(path)
! open(99,file=trim(fname) )
pause
open(12,file=trim(fname),status='old')
read(12,*)
I=I+1
J=0
do
J=J+1
read(12,*,end=20)ht(J),tubt(J),ttt(J)
if (hmax<ht(J)) hmax=ht(J)
if(J==1) then
if(ht(J)-float(floor(ht(J)))>0.25 .and.ht(J)-float(floor(ht(J)))<0.75) then
ht(J)=float(floor(ht(J)))+0.5
elseif(ht(J)-float(floor(ht(J)))>=0.75) then
ht(J)=float(floor(ht(J)))+1.0
else
ht(J)=-999.0
tubt(J)=-999.0
ttt(J)=-999.0
endif
endif
20 close(12)
enddo
lp1: do K=1,29
do N=1,29
if((hh(K)-ht(N))<0.001) then
h(K,I)=ht(N)
tub(K,I)=tubt(N)
tt(K,I)=ttt(N)
cycle lp1
endif
enddo
enddo lp1
write(13,*)fname(1:4),fname(5:6),fname(7:8),fname(9:10),(tt(N,I),N=1,29)
write(14,*)fname(1:4),fname(5:6),fname(7:8),fname(9:10),(tub(N,I),N=1,29)
enddo
30 write(*,*)"normal end"
end
Image 6.png (13.49 KB, 下载次数: 408)
character(len=16)fname
open(11,file="name.txt")
read(11,*)fname
write(*,*)fname
open(12,file=trim(fname),status="old")
read(12,*)
read(12,*)rr,rx
write(*,*)rr,rx
pause
end
欢迎光临 Fortran Coder (http://bbs.fcode.cn/) | Powered by Discuz! X3.2 |