I have a hourly rainfall timeseries from 1970 to 2003. I want to calculate:
n-hour values, n = 2,3,6,12,24 & 48 hr. 24-hr rainfall data can be calculated by accumulating 24 consecutive 1-hr data. Similarly, 48-hr rainfall can be calculated by adding 2-day rainfall values.
From n-hr timeseries, I want to calculate maximum rainfall value for each year.
Likewise, I can compute for other accumulation periods. However, I need suggestions for calculation of annual maximum rainfall value from n-hrly data (aggregated time series), which can be calculated from maximum value of yearly n-hourly rainfall information. For example, from 1970 to 2003, I want to extract 34 annual maxima values correspond to 2,...24 hrs and 19 annual maxima values for 48-hr. Please find sample dataset here:
https://docs.google.com/document/d/1e8g54c6KDw8lwdQ53xi0Bs9fJmasTqbIk2n4LbKA-gM/edit
The frist, second, third & fourth column indicates year, month, day & values respectively.
I tried this code:
ny_p = []; Ann_Max = [];grp_pr = [];
for yr = 1970:1975
i = yr - 1969;
matched = ismember(Precip_Final(:,1), yr, 'rows');
grp_pr = Precip_Final(matched,4); % extracting hourly value of the same year
[nrow,ncol] = size(grp_pr);
for row = 6:nrow % to get 6~ hourly sum
p_new = sum(grp_pr(row-5:row));
ny_p(end+1) = p_new;
end
Max_p = max(ny_p);
Ann_Max = [Ann_Max;Max_p];
clear matched; clear grp_pr; clear i; clear Max_p;
end
I edited my code. Now the problem is: in the matrix ny_p, the earlier years' value also getting stored while running. I want to get an array of maximum n-hrly value of each year in the matrix Ann_Max.