- 积分
- 3144
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2015-7-14
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
本帖最后由 pkn789 于 2019-12-19 10:10 编辑
大家好!我想问fortran读取ARWpost生成的dat文件时不需要做时间循环就会读取所有时刻吗?那如何输出所有时刻所有高度的某点数据到新文件啊?因为数据是三维的,无法输出时间循环。希望能有人帮我解答下,在这里先万分感谢了!!!!
program main
implicit none
Integer(kind=4) :: k,irec,ngridx=51,ngridy=57,nlyr=19
character :: infilename*90
real(kind=4),allocatable, dimension(:,:,:) ::pressure,height,tc,td,wspd,wdir
allocate(pressure(ngridx,ngridy,nlyr))
allocate(height(ngridx,ngridy,nlyr))
allocate(tc(ngridx,ngridy,nlyr))
allocate(td(ngridx,ngridy,nlyr))
allocate(wspd(ngridx,ngridy,nlyr))
allocate(wdir(ngridx,ngridy,nlyr))
irec = 1
print*,irec
infilename='wrfout.dat'
open(14,file=trim(infilename),form='unformatted',status='old',access = 'DIRECT',recl = ngridx*ngridy*4)
print *, 'Input:',infilename
do k=1,nlyr
read(14,rec=1)pressure(:,:,k)
enddo
!print *, 'pressure:',pressure(1:10,1,5)
do k=1,nlyr
irec = irec + 1
read(14,rec=irec)height(:,:,k)
enddo
do k=1,nlyr
irec = irec + 1
read(14,rec=irec)tc(:,:,k)
enddo
do k=1,nlyr
irec = irec + 1
read(14,rec=irec)td(:,:,k)
enddo
do k=1,nlyr
irec = irec + 1
read(14,rec=irec)wspd(:,:,k)
enddo
do k=1,nlyr
irec = irec + 1
read(14,rec=irec)wdir(:,:,k)
enddo
print*,wdir
close(14)
deallocate(pressure,height,tc,td,wspd,wdir)
end
|
|