How to extract certain time in matrix data

Hi.
I have a 476x160x140 precipittaion data (precip/time,lon,lat), from 1981 to 2011 in nc file. Can I extract certain data for a certain year and time? Its like selyear in CDO but I need to do it in Matlab.
Thank you in advance!

댓글 수: 10

sory the file is in mat file.
It is not obvious how the 476 precip/time is layed out? Is it like 4 hours a day measured for 17 selected weeks a year??
For 1981-2011, and each year for 12 months. Its monthly data for 30 years sir.
per isakson
per isakson 2020년 10월 29일
편집: per isakson 2020년 10월 29일
Maybe NetCDF/GRIB reader or some other submission to of File Exchange could be useful. The summary includes this paragraph
Technically speaking, MATLAB-CDI consists of mex-interfaces to the CDI library that read GRIB/netCDF. CDI is the basic library underlying the famous CDO (Climate Data Operators) developed by Max-Planck Institut für Meteorologie in Hamburg. The MATLAB-CDI interface package has been developed by The MathWorks Consulting on behalf of the Rossby Centre, SMHI.
30 years, 12 months per year, gives 360 entries. You have 116 extra entries. Even if your 1981-2011 is 31 years, that would still be an extra 476-12*31 = 104 entries.
oh yes sir. total time(precip)xlonxlat is 372x160x140.
So row index is (year - 1981)*12+month ?
If you were to
data4 = reshape(YourData, [], 12, size(YourData,2), size(YourData,3));
then rows would correspond to years, and dimension 2 would correspond to months, and dimension 3 would correspond to lon, and dimension 4 would correspond to lat. That might make it easier to do month-by-month comparisons across years.
its working sir :') so from here, i can just extract the period that i want, for example i want 1981 year data only. right sir?
Yes if you do the reshape then it becomes easy.
thank you so much sir!

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

답변 (0개)

카테고리

도움말 센터File Exchange에서 Data Import and Analysis에 대해 자세히 알아보기

태그

질문:

2020년 10월 29일

댓글:

2020년 11월 1일

Community Treasure Hunt

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

Start Hunting!

Translated by