1 function outer = insert_analysis(w,paths,a)
2 % puts analysis into the w file
4 %red = subset_domain(w)
5 %paths = graph_dets(w,1) or paths = cluster(paths,w1)
6 %a = squish(paths,1) , this is an anylysis fire arrival time
7 % time format is tign_g, seconds from start
12 %interpolate back to original size grid
13 F = scatteredInterpolant(red.fxlat(:),red.fxlong(:),a(:));
14 a = F(red_orig.fxlat,red_orig.fxlong);
15 figure,contour(red_orig.fxlong,red_orig.fxlat,a,20,'k')
16 title('Analysis resized to original grid spacing')
20 w.analysis = w.tign_g;
21 temp_a = datenum2time(a,red);
22 %shift possible time differneces
23 diff = max(w.tign_g(:))-max(temp_a);
24 temp_a = temp_a + diff;
26 w.analysis(red.ispan,red.jspan)=temp_a;
28 %% adapt to use new use
29 % restart_time=time_bounds(3);
30 % perimeter_time=time_bounds(4);
31 % wf = max(forecast - restart_time,0); % 0 in forecast fire area at restart time, >0 outside
32 % wa = max(perimeter_time-analysis,0); % 0 outside of analysis fire area at perimeter time, >0 inside
34 % % check if we have inclusion so the strip exist
35 % shrink=nnz(wa + wf==0);
37 % fprintf('Cannot spin up, fire area shrinking in analysis at %g points\n',shrink)
38 % warning('Using analysis in place of spinup');
39 % w.spinup = w.analysis
42 % % map the weights so that 0 ->1, 0->1,
43 % vf=1-wf./(wf+wa); % 1 in forecast fire area at restart time, ADDING UP TO 1
44 % va=1-wa./(wf+wa); % 1 outside of analysis fire area at restart time, ADDING UP TO 1
46 % % combine the forecast and analysis
47 % spinup = vf.*forecast + va.*analysis;