[Fortran] 纯文本查看 复制代码 program convert_lat_lon
implicit none
integer :: stat,lata,lona,latb,lonb
character :: station*6
real*8 :: lat,latc,lon,lonc
open (11,file="dbar.txt")
open (22,file="dbar_out.txt")
stat=0
do while (stat==0)
read (11,100,iostat=stat) station,lata,latb,latc,lona,lonb,lonc
100 format (a6,7x,i3,1x,i2,2x,f3.1,3x,i2,1x,i2,2x,f3.1)
if (stat/=0) exit
lat=(lata+(latb/60)+(latc/3600.0000))
lon=(lona+(lonb/60)+(lonc/3600.0000))
write (22,"(a6,3x,f12.8,3x,f11.8)") station,lat,lon
end do
end program
-------------------------------------------------------------------------
想藉由fortran把緯度和經度由分、秒轉換成小數點的表示法
但dbar_out.txt 此檔案卻一直為0KB,沒有寫入,懇請高手大大指教。
|