爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 1354|回复: 2

fortran 读取dat文件出错

[复制链接]

新浪微博达人勋

发表于 2023-4-9 12:43:30 | 显示全部楼层 |阅读模式
20金钱
本帖最后由 虹hhh 于 2023-4-9 12:58 编辑

用grads将nc格式转化为了dat格式,以下为dat和nc信息nc
dset C:\Users\ayqz\Desktop\energycalculate.nc
title
undef -9.99e+33
dtype netcdf
xdef 241 linear 90 0.25
ydef 161 linear 20 0.25
zdef 21 levels 1000 975 950 925 900 850 800 750
700 650 600 550 500 450 400 350 300 250
200 150 100
tdef 32 linear 00Z28DEC2020 180mn
vars 6
z=>z  21  t,z,y,x  Geopotential
r=>r  21  t,z,y,x  Relative humidity
t=>t  21  t,z,y,x  Temperature
u=>u  21  t,z,y,x  U component of wind
v=>v  21  t,z,y,x  V component of wind
w=>w  21  t,z,y,x  Vertical velocity
endvars

dat
dset C:\Users\ayqz\Desktop\energy.dat
title ERA5 uvrhtw data
undef -9.99e+33
xdef 241 linear 90 0.25
ydef 161 linear 20 0.25
zdef 21 levels 1000 975 950 925 900 850 800 750
700 650 600 550 500 450 400 350 300 250
200 150 100
tdef 32 linear 00Z28DEC2020 180mn
vars 6
z  21  t,z,y,x  geopotential
u  21  t,z,y,x  u wind
v  21  t,z,y,x  v wind
r  21  t,z,y,x  relative humidity
t  21  t,z,y,x  tempetature
w  21  t,z,y,x  vertical velocity
endvars


现用fortran提取dat,一直报错,代码以及报错如下,求问为何
  Program main
      integer i,j,k,m,n
        parameter(lon0=90,lon1=150,lat0=20,lat1=60)
        parameter(kk=21,idy=32)
        parameter(ii=4*(lon1-lon0)+1,jj=4*(lat1-lat0)+1)
        parameter(dax=0.25,day=0.25)
        real  u(idy,kk,jj,ii)
        open(10,file="C:\Users\ayqz\Desktop\energy.dat",form='UNFORMATTED',status='old')
        do m=1,idy
        do k=1,kk
        read(10)((u(m,k,j,i),i=1,ii),j=1,jj)
        end do
        end do
        close(10)
        end

报错:
At line 11 of file C:\Users\ayqz\Desktop\by3.f90 (unit = 10, file = 'C:\Users\ayqz\Desktop\energy.dat')
Fortran runtime error: End of file





密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2023-4-9 12:45:33 | 显示全部楼层

                               
登录/注册后可看大图
密码修改失败请联系微信:mofangbao
回复

使用道具 举报

新浪微博达人勋

 楼主| 发表于 2023-4-9 12:50:12 | 显示全部楼层

                               
登录/注册后可看大图
密码修改失败请联系微信:mofangbao
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

Copyright ©2011-2014 bbs.06climate.com All Rights Reserved.  Powered by Discuz! (京ICP-10201084)

本站信息均由会员发表,不代表气象家园立场,禁止在本站发表与国家法律相抵触言论

快速回复 返回顶部 返回列表