how do I extract time series?
Show older comments
Hi all, I am trying to extract the data from the nc list of files using the following loop.
1- extract the whole parameter
2- set them in a 3d matrix
3- calculate the mean
4- extract the data in a given domain
5- calculate the mean to have the time series
I am not convinced with the final result (useries)
any help would be appreciated.
Thank you
useries = [];
for day=1:length(datenum_array);
filename=strcat('./MERRA2_400.tavg1_2d_ocn_Nx.2019',num2str(datevec_array(day,2),'%02i'),num2str(datevec_array(day,3),'%02i'),'.SUB.nc');
% disp(filename)
time = ncread(filename,'time');
lon = ncread(filename,'lon');
lat = ncread(filename,'lat');
%this box domain
lat_range=find(lat<= 28 & lat >= 26);
lon_range=find(lon<= 36.5 & lon >= 33);
time_range = datenum_array(32:12);
%read U10
ucom = ncread(filename,'U10M');
umean = nanmean(ucom,3);
U10 (:,:,day) = umean;
Ubox = U10(lon_range,lat_range,time_range);
umean2 = nanmean(nanmean(nanmean(Ubox)));
useries = [useries,umean2];
end
Accepted Answer
More Answers (0)
Categories
Find more on Matrix Indexing 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!