error using start and count vectors
조회 수: 12 (최근 30일)
이전 댓글 표시
first I've opened a netcdf file. there are 8640 longitude points and 4320 latitude points. it is a world map. I'm trying to map a specific region. I created start and count vectors, then tried to extract the bio data corresponding to those lats and lons. However, I get an error, and can't figure out why.
% make the start and count vectors
start = [1440 1248 1]; % longitude -120.0208, latitude 38.0208
count = [7321 1320 1]; % longitude 125.0208, latitude 35.0208
fld = ncread(url,'bio',start,count);
This is the error I get:
Error using matlab.internal.imagesci.netcdflib
The NetCDF library encountered an error during execution of
'getVarsFloat' function - 'Index exceeds dimension bound
(NC_EINVALCOORDS)'.
Error in netcdf.getVar (line 182)
data =
matlab.internal.imagesci.netcdflib(funcstr,ncid,varid,varargin{:});
Error in internal.matlab.imagesci.nc/read (line 637)
data = netcdf.getVar(gid, varid, ...
Error in ncread (line 66)
vardata = ncObj.read(varName, varargin{:});
채택된 답변
Hrishikesh Borate
2021년 5월 28일
Hi,
It’s my understanding that you are trying to make a map of a specific region from the world map. The ncread function reads data by beginning at the location specified in start. The count argument specifies the number of elements to be read along each dimension. As the start(1) + count(1) exceeds the number of points, ie., 1440+7321 = 8761, which is greater than 8640 points, you are facing the error.
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 NetCDF에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!