Help for running: 3 consecutive days of 95% daily mean temperature

4 views (last 30 days)
My matrice M consist of (longitude, lattitude, days). M(61,15,10958)
To calculate the 95 percentile I take the mean:
M_mean = mean(M,3);
M_mean_pct = prctile(M_mean, 95)
Now I need help for running 3 consecutive days.
days = 0;
HW = 0;
for t = 1:size(M, 3)
if M(:,:,t) > M_mean_pct
days = days + 1;
if days >= 3;
HW = HW +1
HW ongoing = 1
else
HW = 0;
end
What I am trying to run is
for time = 1:days - time
if M(t) > pct95 --> days = days +1
if days > 3 --> heatwave (HW) = heatwave (HW) +1
if heatwave is already present (HW ongoing) = 1
If this is not the case, the heat wave (HW) = 0
Your answer is very much appreciated!

Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!