-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathlabel_dist_type.m
38 lines (34 loc) · 1.01 KB
/
label_dist_type.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
function [dist_type,dist_year,dist_doy]=label_dist_type(curr_cft,curr_time,t_c,vec,next_cft)
% This function is used to provde distubance year and disturbance type
% 1 => regrowth break
% 2 => aforestation break
% 3 => land disturbance
%
% Version 1.0: (Zhe Zhu 10/30/2018)
% Modification: Identifications of Aforestation and Regrowth breaks are modified in Line #27. (Zhe and Shi, 21/08/2020)
%
%% get disurbance pixel
% vec = obs - pred
% only provide disturbance map
% obs - pred
nir = vec(4);
c_nir = curr_cft(2,4);
n_nir = next_cft(2,4);
vis = vec(3);
c_vis = curr_cft(2,3);
n_vis = next_cft(2,3);
swir = vec(5);
c_swir = curr_cft(2,5);
n_swir = next_cft(2,5);
if nir > t_c && vis < -t_c && swir < -t_c
if n_nir > abs(c_nir) && n_vis < -abs(c_vis) && n_swir < -abs(c_swir)
dist_type = 2; % aforestation
else
dist_type = 1; % regrowth
end
else
dist_type = 3; % land disturbance
end
dist_year = datevecmx(curr_time);
dist_year = dist_year(1);
dist_doy = curr_time - datenummx(dist_year,1,0);