|
按照网上的方法写了一个读取nc文件的小程序nc文件为
Band1(1145,702)原始数据为
用该程序得出的结果为
,请问是哪里出了错误
程序如下:
! This program is for reading area.nc
program read
implicit none
integer, parameter :: longitude=3600, latitude=1800
integer ierr,ncid,varid,varidx,varidy,len_file,err
real(8) area(longitude,latitude)
real lon(longitude),lat(latitude)
character*299 barl_out
include 'netcdf.inc'
barl_out='/home/iga/data/xycao/05area/barley/op/barl_harvest_2005_01.nc'
len_file=len_trim(barl_out)
ierr=nf_open(trim(barl_out),nf_write,ncid) !open nc file,get ID number (ncid)
ierr=nf_inq_varid (ncid, 'longitude',varidx)
ierr=nf_get_var_real(ncid,varidx,lon)
ierr=nf_inq_varid (ncid, 'latitude',varidy)
ierr=nf_get_var_real(ncid,varidy,lat)
ierr=nf_inq_varid (ncid, 'Band1', varid) !open 'Band1',get ID number
ierr=nf_get_var_real (ncid,varid,area)
print*,'ierr'
print*, area(1145,702),area(1145,704) !check
err=nf_close(ncid)
end program read
|
|