- 积分
- 961
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2016-10-24
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
请教一下,为什么每次for循环到一半的时候就出现以下错误?(即以这个文件为例,每次循环到12就停止了,然后报错,前面的文件能够正常读写)换了好几个文件都是如此,请大佬指点指点。@二爷名声在外
错误使用 netcdflib
NetCDF 库在执行 'getVarsShort' 函数期间遇到错误 - 'Start+count exceeds dimension bound (NC_EEDGE)'。
出错 netcdf.getVar (line 136)
data = netcdflib(funcstr,ncid,varid,varargin{:});
出错 internal.matlab.imagesci.nc/read (line 635)
data = netcdf.getVar(gid, varid, ...
出错 ncread (line 58)
vardata = ncObj.read(varName, varargin{:});
出错 Untitled2 (line 15)
Divergence = ncread('D:\1.data\ERA_DATA\test.nc', 't', [ lonk1 latk1 t],[lonk2-lonk1+1 latk2-latk1+1 t+3]);
clc;
clear all;
InPath = 'D:\1.data\ERA_DATA\';
ncdisp(strcat(InPath,'test.nc')); %获取所读取nc文件的基本信息
lat = ncread('D:\1.data\ERA_DATA\test.nc', 'latitude');
lon = ncread('D:\1.data\ERA_DATA\test.nc', 'longitude');
time = ncread('D:\1.data\ERA_DATA\test.nc', 'time');
domain = [ 73 136 18 54 ];
lonk1=find( lon == domain(1));
lonk2=find( lon == domain(2));
latk1=find( lat == domain(4));
latk2=find( lat == domain(3));
for t = 1:4 :24
Divergence = ncread('D:\1.data\ERA_DATA\test.nc', 't', [ lonk1 latk1 t],[lonk2-lonk1+1 latk2-latk1+1 t+3]);
Divergence = squeeze( Divergence );
z = 1+(t-1)/2;
result(:,:,z) = zscore(mean(Divergence,3));
end
for n=1:z
xlswrite([int2str(n),'.xls'],result(:,:,n));
end
这是文件描述
Source:
D:\1.data\ERA_DATA\test.nc
Format:
64bit
Global Attributes:
Conventions = 'CF-1.6'
history = '2019-11-24 11:30:55 GMT by grib_to_netcdf-2.14.0: /opt/ecmwf/eccodes/bin/grib_to_netcdf -o /cache/data1/adaptor.mars.internal-1574595051.5639489-12147-6-4174d690-c172-417f-8fb1-f1204a8b50af.nc /cache/tmp/4174d690-c172-417f-8fb1-f1204a8b50af-adaptor.mars.internal-1574595051.5646775-12147-2-tmp.grib'
Dimensions:
longitude = 1440
latitude = 721
time = 24
Variables:
longitude
Size: 1440x1
Dimensions: longitude
Datatype: single
Attributes:
units = 'degrees_east'
long_name = 'longitude'
latitude
Size: 721x1
Dimensions: latitude
Datatype: single
Attributes:
units = 'degrees_north'
long_name = 'latitude'
time
Size: 24x1
Dimensions: time
Datatype: int32
Attributes:
units = 'hours since 1900-01-01 00:00:00.0'
long_name = 'time'
calendar = 'gregorian'
t
Size: 1440x721x24
Dimensions: longitude,latitude,time
Datatype: int16
Attributes:
scale_factor = 0.001283
add_offset = 273.8695
_FillValue = -32767
missing_value = -32767
units = 'K'
long_name = 'Temperature'
standard_name = 'air_temperature'
|
-
-
test.nc
47.54 MB, 下载次数: 2, 下载积分: 金钱 -5
|