필터 지우기
필터 지우기

how to take mean of variables from 00 and 12 GMT observations?

조회 수: 3 (최근 30일)
Sanchit
Sanchit 2023년 7월 20일
댓글: Rena Berman 2023년 7월 31일
% Load the grouping data
lat = ncread(ncfile,'latitude');
lon = ncread(ncfile,'longitude');
expver = ncread(ncfile,'expver');
time = ncread(ncfile,'time');
time = datetime(double(time)*60*60,'ConvertFrom','epochtime','Epoch','1901-01-01');
% convert grouping data to 4x4x2x6961 arrays
[Lon,Lat,Expver,Time] = ndgrid(lon,lat,expver,time);
dataTbl = timetable(Time,Lon,Lat,Expver,d2m,t2m,e,pev,ssr,ssrd,tp,vpd,rh)
% Calculate the mean over latitude x longitude x time
data = groupsummary(dataTbl,["Time","Time"],["hourofday","day"],"mean",4:12)
The above code computes daily average for each day over Lat X Lon and writes
the data of number of rows 3482 for 00 GMT and 3481 for 12 GMT out of total number of observations as 6963. I wish to
calculate the daily average for each day from 00 and 12 GMT also. Therefore,
the dimension of output file becomes (3481,9).
I request you all to please suggest me how to do it in above mentioned code.
Sanchit
  댓글 수: 5
Cris LaPierre
Cris LaPierre 2023년 7월 20일
Yes. See the explanation here.
Rena Berman
Rena Berman 2023년 7월 31일

(Answers Dev) Restored edit

댓글을 달려면 로그인하십시오.

답변 (1개)

Walter Roberson
Walter Roberson 2023년 7월 20일
Now that you have a timetable, you can retime asking for 'hourly'
  댓글 수: 2
Sanchit
Sanchit 2023년 7월 20일
Thank you very much for your kind suggestion. May I request you to please suggest me how to do it in above mentioned code. I would be grateful to you for your kind help.
Sanchit
Walter Roberson
Walter Roberson 2023년 7월 20일
retime(dataTabl(:,4:12), 'hourly', 'mean')

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by