- 积分
- 346
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2013-4-6
- 最后登录
- 1970-1-1
|
楼主 |
发表于 2022-3-16 09:35:34
|
显示全部楼层
生成的txt,打开是乱码
program micaps_diamond
implicit none
integer::time,nlev,nflag ! nb is the number of stations of file, time, nlev,
! and nflag are the ones that will be used while writing grd
integer::i
character*8,allocatable::id(:)
character*8,allocatable::sta(:)
real,allocatable::dir(:)
real,allocatable::speed(:)
real,allocatable::lat(:)
real,allocatable::lon(:)
real,allocatable::u(:)
real,allocatable::v(:)
real,allocatable::ncld(:)
open(11,file="L:/DJBY/feng/wind2017010308.txt",status="old",form="formatted")
read(11,*)
read(11,*)
read(11,*)
allocate(id(426))
allocate(lat(426))
allocate(lon(426))
allocate(dir(426))
allocate(speed(426))
allocate(u(426))
allocate(v(426))
allocate(sta(426))
allocate(ncld(426))
do i=1,426
read(11,*) lon(i),lat(i),id(i),sta(i),dir(i),speed(i),ncld(i)
u(i)=(-1)*sin(dir(i)*3.14/180)*speed(i)
v(i)=(-1)*cos(dir(i)*3.14/180)*speed(i)
enddo
close(11)
open(21,file="L:\DJBY\feng\2017010308wind2.txt",status="replace",form="binary")
time=1
nlev=1
nflag=1
do i=1,426
write(21) id(i),lon(i),lat(i),time,nlev,nflag,u(i),v(i)
enddo
nlev=0
write(21) lon(i-1),lat(i-1),id(i-1),time,nlev,nflag
close(21)
end |
|