1 function plot_svm(varargin)
3 % plot_results(svm_file)
4 % plot_results(svm_file,result_file)
5 % plot_results(svm_file,result_file,zoom)
8 % Plots the results in the output file from Support Vector Machine
11 % svm_file matlab output file from Support Vector Machine
12 % result_file matlab output file from preprocessing of satellite data
13 % zoom boolean if plot zoom or not (default false)
15 % Developed in Matlab 9.2.0.556344 (R2017a) on MACINTOSH.
16 % Angel Farguell (angel.farguell@gmail.com), 2019-03-21
17 %-------------------------------------------------------------------------
19 if nargin < 1 || nargin > 3
20 error('plot_svm(svm_file) or plot_svm(svm_file,result_file) or plot_svm(svm_file,result_file,zoom)');
22 svm_file = varargin{1};
25 uu(uu==max(uu(:))) = nan;
27 ll(ll==min(ll(:))) = nan;
31 result_file = varargin{2};
32 r2 = load(result_file);
33 tt = (r2.T==r2.time_scale_num(2)-r2.time_scale_num(1));
37 scatter3(r.dxlon(~isnan(uu)), r.dxlat(~isnan(uu)), uu(~isnan(uu)), 'r.')
39 scatter3(r.dxlon(~isnan(ll)), r.dxlat(~isnan(ll)), ll(~isnan(ll)), 'g.')
46 bb = [min(r.dxlon(~isnan(uu)))-dd, max(r.dxlon(~isnan(uu)))+dd, min(r.dxlat(~isnan(uu)))-dd, max(r.dxlat(~isnan(uu)))+dd];
48 S = repmat(5,sum(sum(~isnan(uu))),1);
49 C = repmat([1,0,0],sum(sum(~isnan(uu))),1);
50 h1 = scatter3(r.dxlon(~isnan(uu)), r.dxlat(~isnan(uu)), uu(~isnan(uu)), S, C, 'filled');
52 set(h1, 'MarkerEdgeAlpha', alpha, 'MarkerFaceAlpha', alpha)
55 S = repmat(5,sum(sum(~isnan(ll))),1);
56 C = repmat([0.2,0.7,0.2],sum(sum(~isnan(ll))),1);
57 h2 = scatter3(r.dxlon(~isnan(ll)), r.dxlat(~isnan(ll)), ll(~isnan(ll)), S, C, 'filled');
59 set(h2, 'MarkerEdgeAlpha', alpha, 'MarkerFaceAlpha', alpha)
62 ml = logical((r.dxlon >= bb(1)).*(r.dxlon <= bb(2)).*(r.dxlat >= bb(3)).*(r.dxlat <= bb(4)));
63 S = repmat(5,sum(sum(ml)),1);
64 C = repmat([0.2,0.7,0.2],sum(sum(ml)),1);
65 h3 = scatter3(r.dxlon(ml), r.dxlat(ml), ll(ml), S, C, 'filled');
67 set(h3, 'MarkerEdgeAlpha', alpha, 'MarkerFaceAlpha', alpha)
70 contour3(r.fxlon,r.fxlat,r.Z,100)
73 title('Support-vector machine: Fire detections vs fire arrival time')
80 zz = [min(r.Z(:))-.5 min(r.Z(:))+1.5];
82 scatter3(r.dxlon(~isnan(uu)), r.dxlat(~isnan(uu)), uu(~isnan(uu)), 'r.')
85 scatter3(r.dxlon(~isnan(ll)), r.dxlat(~isnan(ll)), ll(~isnan(ll)), 'g.')
88 contour3(r.fxlon(1:kk:end,1:kk:end),r.fxlat(1:kk:end,1:kk:end),r.Z(1:kk:end,1:kk:end),500)
91 title('2 days envolving the ignition time')
98 scatter3(r.dxlon(~isnan(uu)), r.dxlat(~isnan(uu)), uu(~isnan(uu)), 'r.')
100 contour3(r.fxlon,r.fxlat,r.Z,100)
101 title('Support-vector machine: Fire detections vs fire arrival time')
104 zlabel('Time (days)')