gitinore *.txt files
[wrf-fire-matlab.git] / cycling / detection_ellipse.m
blobf8f940e081c0eb959fefe713650bc00b13466b91
1 function e = detection_ellipse(g,r)
2 %function e = detection_ellipse(g)
3 % function returns eigenvectors for ellipse containg fire detections
4 % inputs;
5 %   g        struct, detection structure from subset_detections
6 %   r       struct, fire data from subset_domain
7 %output:
8 %   e        struct with eigenvectors for ellipse contining detections
10 d = detection_list(g,r);
11 fire_idx = find(d);
12 fires = zeros(length(fire_idx),2);
13 fire_lons = r.fxlong(fire_idx);
14 fire_lats = r.fxlat(fire_idx);
15 fires(:,1) = fire_lons;
16 fires(:,2) = fire_lats;
18 %[sat_in,sat_on] = inpolygon(r.fxlong(:),r.fxlat(:),fire_lons,fire_lats);
19 fire_area = length(fire_idx);
20 %fprintf('satellite area ~= %d \n',fire_area);
22 %scatter plot the detections 
23 % figure,scatter(fire_lons,fire_lats)
24 % hold on
25 % shrink = 0.75;
26 % k = boundary(fire_lons,fire_lats,shrink);
27 % plot(fire_lons(k),fire_lats(k));
29 e = ellipse_fit(fires,1.96);
30 e.area = fire_area;
31 e.ellipse_area = det(e.d);
35 end