| 这个错误我无法重现,可能是日文系统的问题,我也无法解释。 |
|
自己试了一下,把open(12,file=trim(fname),status='old') 中的12换成22 成功运行。这是为什么?? 我已经用一下代码试过: [Fortran] 查看源码 复制源码 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可以操作。 疯了 |
捐赠本站|Archiver|关于我们 About Us|小黑屋|Fcode ( 京ICP备18005632-2号 )
GMT+8, 2025-11-17 04:50