I wish to calculate the mean values of temperature over the latxlon grid and only for 12GMT for all the 65 months using matlab code.

조회 수: 10 (최근 30일)
I have a data with dimension (lat,lon,time,months) as (5,5,2,65)
number of latitude =5
number of longitude =5
time = 1 for 00 GMT and 2 for 12 GMT
number of months 65
I wish to calculate the mean values of temperature over the latxlon grid and only for 12GMT for all the 65 months using matlab code.
Any suggestions would be highly appreciated.
regards,
Devendra

답변 (2개)

Sathvik
Sathvik 2023년 6월 29일
Hi
You can take the mean of the data as such
latxlon = randi([20 40],5,5,2,65);
meanTemp = mean(latxlon(:,:,2,:));
If you want to take the mean over all 65 months, you can take the mean along the 4th dimension.
meanTemp = mean(latxlon(:,:,2,:),4)
meanTemp = 5×5
29.7692 30.6923 29.1538 30.1231 29.3538 29.8923 31.0308 30.4000 28.9077 28.4154 29.9538 31.0308 30.4462 30.4308 30.8154 30.7077 29.6462 30.3077 30.2769 29.5692 30.4308 30.8154 29.6154 29.0769 29.9846
Here is a link to the documentation
Hope this helps!
  댓글 수: 4
Sanchit
Sanchit 2023년 7월 18일
I have attached the netcdf matlab code to read the data and netcdf input file. I want to calculate the mean values of nine varaibles over lat x lon x time x 6961 (4,4,2,6961) for each variable. I request you to kindly modify the code to get the required data. Thanks a lot for your help.
Sanchit

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


Cris LaPierre
Cris LaPierre 2023년 7월 20일

카테고리

Help CenterFile Exchange에서 Data Import and Analysis에 대해 자세히 알아보기

제품


릴리스

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by