-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheddy_ratios_by_latitude.m
131 lines (111 loc) · 6.2 KB
/
eddy_ratios_by_latitude.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
% Experiement to determine any latitude-dependent correlation of the
% cyclonic/anticyclonic ratios of hurricane encountered eddies.
% latitude increments
increments = 0:10:70;
% for easier generalization
data = IBTrACS_1992_2010(~isnan(IBTrACS_1992_2010.EddyClass),:);
% columns = [cyc/acyc_ratio, cyc_count, acyc_count]
n_results = NaN(7,3);
s_results = NaN(7,3);
for i = 1 : length(increments) - 1
lower_bound = increments(i);
upper_bound = increments(i+1);
n_idx = bitand(data.Latitude_for_mapping <= upper_bound,...
data.Latitude_for_mapping > lower_bound);
s_idx = bitand(data.Latitude_for_mapping < -lower_bound,...
data.Latitude_for_mapping >= -upper_bound);
ibt_lat_seged.N{i} = data(n_idx,:);
ibt_lat_seged.S{i} = data(s_idx,:);
n_cyc = sum(ibt_lat_seged.N{i}.EddyClass == -1);
n_acyc = sum(ibt_lat_seged.N{i}.EddyClass == 1);
n_results(i,2) = n_cyc;
n_results(i,3) = n_acyc;
n_results(i) = n_cyc / n_acyc;
s_cyc = sum(ibt_lat_seged.S{i}.EddyClass == -1);
s_acyc = sum(ibt_lat_seged.S{i}.EddyClass == 1);
s_results(i,2) = s_cyc;
s_results(i,3) = s_acyc;
s_results(i) = s_cyc / s_acyc;
end
ibt_lat_seged.increments = increments;
%% Further segment by hurricane category
hur_cats = {'unknown';'TS';'TD';'1';'2';'3';'4';'5'};
for i = 1 : 7
figure;
%% Northern Hemisphere
subplot(2,1,1);
temp = ibt_lat_seged.N{i};
t_idx = bitor(bitor(strcmp(temp.Category, hur_cats{1}),strcmp(temp.Category, hur_cats{2})),...
strcmp(temp.Category, hur_cats{3}));
one_idx = strcmp(temp.Category, hur_cats{4});
two_idx = strcmp(temp.Category, hur_cats{5});
three_idx = strcmp(temp.Category, hur_cats{6});
four_idx = strcmp(temp.Category, hur_cats{7});
five_idx = strcmp(temp.Category, hur_cats{8});
y = zeros(6,1);
y(1) = sum(bitand(temp.EddyClass == -1, t_idx)) / sum(bitand(temp.EddyClass == 1, t_idx)); %tropical
y(2) = sum(bitand(temp.EddyClass == -1, one_idx)) / sum(bitand(temp.EddyClass == 1, one_idx)); % cat 1
y(3) = sum(bitand(temp.EddyClass == -1, two_idx)) / sum(bitand(temp.EddyClass == 1, two_idx));
y(4) = sum(bitand(temp.EddyClass == -1, three_idx)) / sum(bitand(temp.EddyClass == 1, three_idx));
y(5) = sum(bitand(temp.EddyClass == -1, four_idx)) / sum(bitand(temp.EddyClass == 1, four_idx));
y(6) = sum(bitand(temp.EddyClass == -1, five_idx)) / sum(bitand(temp.EddyClass == 1, five_idx)); % cat 5
plot([0; 1; 2; 3; 4; 5], y, 'o-b');
hold on
% build labels for each data point
labels = cell(6,1);
labels{1} = strcat(num2str(sum(bitand(temp.EddyClass == -1, t_idx))), '/', num2str(sum(bitand(temp.EddyClass == 1, t_idx))));
labels{2} = strcat(num2str(sum(bitand(temp.EddyClass == -1, one_idx))), '/', num2str(sum(bitand(temp.EddyClass == 1, one_idx))));
labels{3} = strcat(num2str(sum(bitand(temp.EddyClass == -1, two_idx))), '/', num2str(sum(bitand(temp.EddyClass == 1, two_idx))));
labels{4} = strcat(num2str(sum(bitand(temp.EddyClass == -1, three_idx))), '/', num2str(sum(bitand(temp.EddyClass == 1, three_idx))));
labels{5} = strcat(num2str(sum(bitand(temp.EddyClass == -1, four_idx))), '/', num2str(sum(bitand(temp.EddyClass == 1, four_idx))));
labels{6} = strcat(num2str(sum(bitand(temp.EddyClass == -1, five_idx))), '/', num2str(sum(bitand(temp.EddyClass == 1, five_idx))));
% text([0; 1; 2; 3; 4; 5],(y+0.25), labels{:});
text(0+0.2,y(1),labels{1})
text(1+0.2,y(2),labels{2})
text(2+0.2,y(3),labels{3})
text(3+0.2,y(4),labels{4})
text(4+0.2,y(5),labels{5})
text(5+0.2,y(6),labels{6})
title(strcat('Northern Hemisphere Latitude: ', num2str(increments(i)), ' to ',...
num2str(increments(i+1))))
ylabel('cyc/acyc ratio')
xlabel('Hurricane Category')
%% Southern Hemisphere
subplot(2,1,2);
temp = ibt_lat_seged.S{i};
t_idx = bitor(bitor(strcmp(temp.Category, hur_cats{1}),strcmp(temp.Category, hur_cats{2})),...
strcmp(temp.Category, hur_cats{3}));
one_idx = strcmp(temp.Category, hur_cats{4});
two_idx = strcmp(temp.Category, hur_cats{5});
three_idx = strcmp(temp.Category, hur_cats{6});
four_idx = strcmp(temp.Category, hur_cats{7});
five_idx = strcmp(temp.Category, hur_cats{8});
y = zeros(6,1);
y(1) = sum(bitand(temp.EddyClass == -1, t_idx)) / sum(bitand(temp.EddyClass == 1, t_idx)); %tropical
y(2) = sum(bitand(temp.EddyClass == -1, one_idx)) / sum(bitand(temp.EddyClass == 1, one_idx)); % cat 1
y(3) = sum(bitand(temp.EddyClass == -1, two_idx)) / sum(bitand(temp.EddyClass == 1, two_idx));
y(4) = sum(bitand(temp.EddyClass == -1, three_idx)) / sum(bitand(temp.EddyClass == 1, three_idx));
y(5) = sum(bitand(temp.EddyClass == -1, four_idx)) / sum(bitand(temp.EddyClass == 1, four_idx));
y(6) = sum(bitand(temp.EddyClass == -1, five_idx)) / sum(bitand(temp.EddyClass == 1, five_idx)); % cat 5
plot([0; 1; 2; 3; 4; 5], y, 'o-b');
hold on
% build labels for each data point
labels = cell(6,1);
labels{1} = strcat(num2str(sum(bitand(temp.EddyClass == -1, t_idx))), '/', num2str(sum(bitand(temp.EddyClass == 1, t_idx))));
labels{2} = strcat(num2str(sum(bitand(temp.EddyClass == -1, one_idx))), '/', num2str(sum(bitand(temp.EddyClass == 1, one_idx))));
labels{3} = strcat(num2str(sum(bitand(temp.EddyClass == -1, two_idx))), '/', num2str(sum(bitand(temp.EddyClass == 1, two_idx))));
labels{4} = strcat(num2str(sum(bitand(temp.EddyClass == -1, three_idx))), '/', num2str(sum(bitand(temp.EddyClass == 1, three_idx))));
labels{5} = strcat(num2str(sum(bitand(temp.EddyClass == -1, four_idx))), '/', num2str(sum(bitand(temp.EddyClass == 1, four_idx))));
labels{6} = strcat(num2str(sum(bitand(temp.EddyClass == -1, five_idx))), '/', num2str(sum(bitand(temp.EddyClass == 1, five_idx))));
% text([0; 1; 2; 3; 4; 5],(y+0.25), labels{:});
text(0+0.2,y(1),labels{1})
text(1+0.2,y(2),labels{2})
text(2+0.2,y(3),labels{3})
text(3+0.2,y(4),labels{4})
text(4+0.2,y(5),labels{5})
text(5+0.2,y(6),labels{6})
title(strcat('Southern Hemisphere Latitude: -', num2str(increments(i)), ' to -',...
num2str(increments(i+1))))
ylabel('cyc/acyc ratio')
xlabel('Hurricane Category')
end