如何从包含闰年的数据中每年取出极端事件

时间:2014-04-23 05:31:52

标签: matlab

我有程序(matlab),每年计算一次极端事件整整95年,但该程序仅适用于那些不包含闰年的人。

e.g。数据大小是20x22x34675(离子,纬度,时间)(365 * 95),但我想计算每年包含闰年的数据的极端事件(这意味着365或366然后365或366 ....每个单独的年份)然后这项计划会有什么变化呢?

我的数据大小为prec_all_years:20x22x34698(lon,lat,time)(365 * 95 + 23 = 34698)。这是每日数据。

prec_all_years = prec_all_years*86400; % rainfall in mm/day

bins = [64.5 124.5 244.5 Inf];

% Reshape into lat/lon/day/year, and bin over 3rd dimension (days)

counts = histc(reshape(prec_all_years,20,22,365,95),bins,3);

% Extract the counts for each of the 3 categories

hr = squeeze(counts(: , : , 1 , : ));

vhr = squeeze(counts(: , : , 2 , : ));

ehr = squeeze(counts(: , : , 3 , : ));

% Extract a region

xe = 13:20; ye = 11:16;% xe is x for east,ye is y for east

% Extract counts for each category

count_hr_east = sum(reshape(hr(xe , ye , : ) , [] , 95 ));

count_vhr_east = sum(reshape(vhr(xe , ye , : ) , [] , 95 ));

count_ehr_east = sum(reshape(ehr(xe , ye , : ) , [] , 95 ));

0 个答案:

没有答案