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
Nurul Ain Basirah Zakaria 2020 年 10 月 29 日
sory the file is in mat file.
Walter Roberson
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
Nurul Ain Basirah Zakaria 2020 年 10 月 29 日
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.
Walter Roberson
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
Nurul Ain Basirah Zakaria 2020 年 10 月 29 日
oh yes sir. total time(precip)xlonxlat is 372x160x140.
Walter Roberson
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
Nurul Ain Basirah Zakaria 2020 年 10 月 29 日
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?
Walter Roberson
Walter Roberson 2020 年 10 月 29 日
Yes if you do the reshape then it becomes easy.
Nurul Ain Basirah Zakaria
Nurul Ain Basirah Zakaria 2020 年 11 月 1 日
thank you so much sir!

サインインしてコメントする。

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeData Import and Analysis についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by