How to take values above threshold with the certain consecutive days?
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
Image Analyst
2021-5-1
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.
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Time Series Objects 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!