登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
最近很多同学都用到这个,本人不才,也来献献丑。
单时次转化:
- program main
- real vec(160)
- real lat(160),lon(160)
- character*8 stid(160)
- open(1,file='c:\data\r16006.txt',status='old')
- read(1,*) (vec(i),i=1,160)
- close(1)
- open(2,file='c:\data\china.txt')
- do k=1,160
- read(2,*) lat(k),lon(k)
- enddo
- close(2)
- do 2 i=1,160
- 2 stid(i)=char(i)
- open (3,file='c:\data\r16006.grd',form='binary')
- tim=0.0
- nlev=1
- nflag=1
- do i=1,160
- write(3) stid(i),lat(i),lon(i),tim,nlev,nflag,vec(i)
- enddo
- nlev=0
- write(3) stid(i-1),lat(i-1),lon(i-1),tim,nlev,nflag
- close(3)
- end
多时次转化:
- program main
- real vec(160,50)
- real lat(160),lon(160)
- character*8 stid(160)
- open(1,file='r16006.txt',status='old')
- read(1,*) ((vec(i,j),i=1,160),j=1,50)
- close(1)
- open(2,file='china.txt')
- do k=1,160
- read(2,*) lat(k),lon(k)
- enddo
- close(2)
- do 2 i=1,160
- 2 stid(i)=char(i)
- open (3,file=r16006.grd',form='binary')
- do j=1,50
- tim=0.0
- nlev=1
- nflag=1
- do i=1,160
- write(3) stid(i),lat(i),lon(i),tim,nlev,nflag,vec(i,j)
- enddo
- nlev=0
- write(3) stid(i-1),lat(i-1),lon(i-1),tim,nlev,nflag
- enddo
- close(3)
- end
大家注意改路径
|