Clear Filters
Clear Filters

how to load big netcdf file?

12 views (last 30 days)
Hello
I was wondering why Matlab could not able to load 3GB file to the work space. I have Netacdf file format with 3GB an di tried to load it to the work space using ncread as shown below. but it results in error message.
Does any has better ideas for this error.
P = ncread('v2p0chirps_25.nc','precip');
Error using netcdflib
Requested 1440x400x14853 (31.9GB) array
exceeds maximum array size preference.
Creation of arrays greater than this
limit may take a long time and cause
MATLAB to become unresponsive. See
array size limit or preference panel
for more information.
Error in netcdf.getVar (line 140)
data =
netcdflib(funcstr,ncid,varid,varargin{:});
Error in
internal.matlab.imagesci.nc/read (line
605)
data =
netcdf.getVar(gid,
varid);
Error in ncread (line 66)
vardata = ncObj.read(varName,
varargin{:});

Accepted Answer

Benjamin Thompson
Benjamin Thompson on 1 Feb 2022
The ncread function accepts additional arguments for a starting position and number of elements to read. See the help on ncread. Or you could increase array size limit in the MATLAB preferences as your error suggests. Looks like MATLAB wants a 31.9GB array though so that might be hard to do.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!