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.
显示 更早的评论
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]
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 NetCDF Files 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!