MATLAB Answers

How to take values above threshold with the certain consecutive days?

2 views (last 30 days)
Ahmad Bayhaqi
Ahmad Bayhaqi on 1 May 2021
Commented: Image Analyst on 1 May 2021
Hi All, I have temperature data 76x80x12052 defining longitude x latitude xs temperature value. also an array 1 x 12052 as the datetime.
I want to take a temperature value above threshold with the minimum 5 consecutive days.
I used this code
[latGrid, lonGrid] = meshgrid(1:80,1:76);
tResult = table(latGrid(:),lonGrid(:),'VariableNames',{'lat','lon'});
tResult.extData = cell(height(tResult),1);
for kk1 = 1:height(tResult)
% break down into 1-D problem and apply the original answer
lat = tResult.lat(kk1);
lon = tResult.lon(kk1);
idx0 = bwareafilt(squeeze(idx(lon,lat,:)),[5,Inf]);
a0 = squeeze(sst2(lon,lat,:));
label = bwlabel(idx0);
N = cell(max(label),1);
for kk2 = 1:max(label)
N{kk2} = a0(label == kk2);
end
tResult.extData{kk1} = N;
end
then the output is the table with the cell containing the group of temperature values which above the threshold:
However, the table does not include the date time. So, is there a way to include the date time in the output so I can know the time when the temperature exceeds the temperature?
Thank you
  1 Comment
Image Analyst
Image Analyst on 1 May 2021
Probably. But I'm not going to try anything until you attach your data in a .mat file. Make it easy for us to help you, not hard.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by