I have a big 1.5 GB .nc file. Data loading is the slowest part of my processing, but I'm lucky that it will be sufficient to load only every Nth data point. Loading the whole file takes about 0.14 seconds:
z = ncread('myfile.nc','z');
Elapsed time is 0.142669 seconds.
which is about the same amount of time it takes when I specify that which indices to load:
z = ncread('myfile.nc','z',[1 1],[Inf Inf],[1 1]);
Elapsed time is 0.156108 seconds.
And so it should be faster if I specify a "stride" of more than 1. But it actually takes much more time to load every 2nd datapoint:
z = ncread('myfile.nc','z',[1 1],[Inf Inf],[2 2]);
Elapsed time is 4.992349 seconds.
Increasing the stride length beyond 2 seems to bring data loading time back down, but I have to use a stride length of 8 or more to get any benefit at all. What gives? Any ideas for fixes?