Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

New to MATLAB?

problems reading large netcdf file; returns zeros

Asked by Bodil

Bodil (view profile)

on 22 Nov 2012

My netcdf file contains temperatures in 6 hours time bins between 1991 and 2010. From nc_dump or ncdisp, I get the information that the temperature comes in the dimension 96x48x63x30660, i.e. longitude, latitude, pressure level and time. However, after time step 1071, the matrix seems to be filled with up zeros. Even the time vector gives me zeros after 1071 elements. Up until then, the temperature data looks fine. People using IDL get the whole file, so it doesn't seem to be an issue with the netcdf-file. I don't get an error message.

Here is my routine:

%%%%%%%%%%%%%%%%%%%%%%%%%%%

filename = 'temperature.nc';

ind=(1:4:30660);

for i=1:(30660/4);

one_day_of_data=ncread(filename,'temp',[1 1 1 ind(i)],[96 48 63 4],[1 1 1 1]);

daily_T(i,:,:)=squeeze(mean(mean(one_day_of_data,4),1));

end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

1 Comment

Ashish Uthama

Ashish Uthama (view profile)

on 4 Jan 2013

Is the file available for public download? I cant explain why this might happen (MATLAB uses libnetcdf under the hood).

Bodil

Bodil (view profile)

Products

No products are associated with this question.

0 Answers

Contact us