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.
Mostra commenti meno recenti
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]
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su NetCDF Files in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!