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
Nurul Ain Basirah Zakaria
2020년 10월 29일
Walter Roberson
2020년 10월 29일
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??
Nurul Ain Basirah Zakaria
2020년 10월 29일
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.
Walter Roberson
2020년 10월 29일
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.
Nurul Ain Basirah Zakaria
2020년 10월 29일
Walter Roberson
2020년 10월 29일
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.
Nurul Ain Basirah Zakaria
2020년 10월 29일
Walter Roberson
2020년 10월 29일
Yes if you do the reshape then it becomes easy.
Nurul Ain Basirah Zakaria
2020년 11월 1일
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Data Import and Analysis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!