I am able to read the netcdf file format. But how to calculate average? Suppose I have to calculate the average from 1st January to 5th January, then again 6th January to 10th January and so on.....Below is the program to read the values.
Show older comments
ncid = netcdf.open('data.nc', 'NC_NOWRITE');
[ndim,nvar,natt,unlim] = netcdf.inq(ncid);
[dimname,dimlength]=netcdf.inqDim(ncid,0);
[dimname,dimlength]=netcdf.inqDim(ncid,1);
[dimname,dimlength]=netcdf.inqDim(ncid,2);
[dimname,dimlength]=netcdf.inqDim(ncid,3);
netcdf.inqDim(ncid,dimids);
[varname, xtype, dimid, natt] = netcdf.inqVar(ncid, 0);
[varname, xtype, dimid, natt] = netcdf.inqVar(ncid, 1);
[varname, xtype, dimid, natt] = netcdf.inqVar(ncid, 2);
[varname, xtype, dimid, natt] = netcdf.inqVar(ncid, 3);
[varname, xtype, dimid, natt] = netcdf.inqVar(ncid, 4);
[varname, xtype, dimid, natt] = netcdf.inqVar(ncid, 5);
lat = netcdf.getVar(ncid,0,0,72);
lon = netcdf.getVar(ncid,1,0,144);
precJanuary = netcdf.getVar(ncid,4,[0 0 0 0],[144 72 1 1]); % for january data
But how to calculate average? Suppose I have to calculate the average from 1st January to 5th January, then again 6th January to 10th January and so on.....
[Edited for code formatting -AU]
Accepted Answer
More Answers (0)
Categories
Find more on NetCDF Files in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!