Fortran Coder
标题: 求大佬们帮忙看一哈这个数据输出为二进制 [打印本页]
作者: hpa 时间: 2020-4-6 16:26
标题: 求大佬们帮忙看一哈这个数据输出为二进制
本帖最后由 kyra 于 2020-4-6 18:28 编辑
[Fortran] syntaxhighlighter_viewsource syntaxhighlighter_copycode
open(12,file='F:/station_operation1.grd',access='direct',status='replace',form='unformatted',recl=18627*9)
irec = 1
do m=1,9
do n=1,18627
write(12,rec=irec) h(n,m)
irec = irec + 1
end do
end do
close(12)
大佬们帮忙看一下有没有问题,我输出位二进制文件后用grads画图,但是画出来都是0
9是9个变量,18627是时间
作者: li913 时间: 2020-4-6 18:14
open(12,file='F:/station_operation1.grd',access='stream')
write(12) h(1:18627,1:9)
close(12)
作者: kyra 时间: 2020-4-6 18:29
如果你非要直接读写。那么 recl 应该和每次循环输出的长度相匹配。
[Fortran] syntaxhighlighter_viewsource syntaxhighlighter_copycode
open(12,file='F:/station_operation1.grd',access='direct',status='replace',form='unformatted',recl=18627*9)
write(12,rec=1) h(1:18627,1:9)
close(12)
或者
[Fortran] syntaxhighlighter_viewsource syntaxhighlighter_copycode
open(12,file='F:/station_operation1.grd',access='direct',status='replace',form='unformatted',recl=1)
irec = 1
do m=1,9
do n=1,18627
write(12,rec=irec) h(n,m)
irec = irec + 1
end do
end do
close(12)
作者: hpa 时间: 2020-4-7 14:36
谢谢您了,版主,我明白了,我已经修改对了
作者: hpa 时间: 2020-4-7 14:45
谢谢您了,已经修改正确了,麻烦您了
欢迎光临 Fortran Coder (http://bbs.fcode.cn/) |
Powered by Discuz! X3.2 |