1 function [d,v] =perim_distance(w,g)
2 %computes distance from ignition to furthest point on perimeter, avg ROS to get there
4 % input - w, struct with tign
5 % g, struct with detections
6 %output -d,v distance (m), ros (m/s)
9 min_t = min(r.tign_g(:));
10 max_t = max(r.tign_g(:)-10);
13 [x0,y0] = find(r.tign_g==min_t);
14 fm = r.tign_g < max_t;
21 %loop through the distances...
22 point = [r.fxlat(x0,y0),r.fxlong(x0,y0)];
23 ignition_point = point;
26 for i=1:10:length(longs)
27 new_point = [lats(i),longs(i)];
28 new_d = distance(new_point,ignition_point,E);
38 %compute distance in satellite data
40 if sum(g(j).det(3:5)) > 0
42 det_longs = g(j).xlon(dm);
43 det_longs = det_longs(:);
44 det_lats = g(j).xlat(dm);
45 det_lats = det_lats(:);
47 if norm(det_ignition) ==0
48 det_ignition(1) = mean(det_lats);
49 det_ignition(2) = mean(det_longs);
50 det_start = g(j).time;
52 for k = 1:length(det_lats)
53 new_det_point = [det_lats(k),det_longs(k)];
54 new_dd = distance(new_det_point,det_ignition,E);
57 det_point = new_det_point;
65 det_t = (det_time-det_start)*(3600*24);
67 fprintf('Forecast distanc: %0.2f Forecast ROS: %0.2f \n',d,v)
68 fprintf('Detection distance : %0.2f Detection ROS: %0.2f \n',dd,dv);
71 c_lines = linspace(min_t,max_t,n);
73 figure,contour(r.fxlong,r.fxlat,r.tign_g,c_lines,'k')
75 scatter(ignition_point(2),ignition_point(1),500,'*r')
76 scatter(point(2),point(1),500,'r*');
77 title('Foecast points')
80 figure,contour(r.fxlong,r.fxlat,r.tign_g,c_lines,'k')
81 title('Detection Points');
83 scatter(det_ignition(2),det_ignition(1),500,'*r');
84 scatter(det_point(2),det_point(1),500,'*r');