error using start and count vectors

13 ビュー (過去 30 日間)
Candice Cooper
Candice Cooper 2021 年 5 月 25 日
コメント済み: BN 2022 年 11 月 7 日
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{:});
  1 件のコメント
BN
BN 2022 年 11 月 7 日
Dear @Candice Cooper did you find any solution for this? I have a same problem. Thank you

サインインしてコメントする。

採用された回答

Hrishikesh Borate
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.
For more information, refer to ncread.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeNetCDF についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by