How to calculate average of Netcdf daily data
조회 수: 3 (최근 30일)
이전 댓글 표시
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 31st January, then again 1th Feb. to 26th Feb. and so on.....Below is the program to read the values. and also attaching the data sets
%% New Program for Wind Vector data=netcdf.open('uwnd.sig995.2014.nc','NC_NOWRITE'); data1=netcdf.open('vwnd.sig995.2014.nc','NC_NOWRITE');
ug=netcdf.getVar(data,3,[0 0 0],[144 73 1],'double'); vg=netcdf.getVar(data1,3,[0 0 0],[144 73 1],'double'); lat1 = netcdf.getVar(data,0,0,73); lon1 = netcdf.getVar(data,1,0,144); ind = find(ug==9999); ug(ind) = NaN; vg(ind) = NaN; % end
[Lat, Lon] = meshgrid ( lat1, lon1 ); ws=sqrt(ug.^2+vg.^2);
% figure magnification
m_proj('Mercator','lon',[65 100],'lat',[5 40],'rect','on'); % Making projection % m_pcolor(Lon,Lat,ws); m_coast('patch',[.6 1 .6],'edgecolor','none'); m_grid('tickdir','out','yaxislocation','right',... 'xaxislocation','top','xlabeldir','end','ticklen',.02);
hold on
m_contourf(Lon,Lat,ws)
% m_plot(Lon,Lat,'color','k','linewidth',2.5);
m_quiver(Lon,Lat,ug,vg,50,'k');
hold off
댓글 수: 0
답변 (1개)
참고 항목
카테고리
Help Center 및 File Exchange에서 NetCDF에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!