[Fortran] 纯文本查看 复制代码
program radiosonde_PWV_B
implicit none
integer :: stat,stat2,stat3,height_m1,height_m2,yr1,doy1,hr1,yr2,doy2,hr2
character :: filename*13,filename_new*13
real*8 :: timeall1,part_vapor_weight1,timeall2,part_vapor_weight2,pwv
open (11,file='list.txt')
close (11,status='delete')
call system ('dir /b *.radio2 > list.txt')
open (11,file='list.txt')
stat=0
do while (stat==0)
read (11,*,iostat=stat) filename
if (stat/=0) exit
open (22,file=filename)
filename_new=filename(1:6)//'.radio3'
open (33,file=filename_new)
stat2=0
stat3=0
do while (stat2==0 .and. stat3==0)
read (22,*,iostat=stat2) timeall1,height_m1,part_vapor_weight1,yr1,doy1,hr1
read (22,*,iostat=stat3) timeall2,height_m2,part_vapor_weight2,yr2,doy2,hr2
if (stat2/=0 .or. stat3/=0) exit
backspace (22)
if ( hr1==hr2 ) then
pwv=(part_vapor_weight1+part_vapor_weight2)*(height_m2-height_m1)*1D3/2
write (33,50) timeall1,height_m1,height_m2,pwv,yr1,doy1,hr1
50 format (f12.7,1x,i5.5,1x,i5.5,1x,f12.7,1x,i4,1x,i3.3,1x,i2.2)
else if ( hr1/=hr2 ) then
cycle
end if
end do
end do
end program