1 function J=detection_log_likelihood(prefix,w)
2 % loglike=detection_data_log_likelihood(prefix,w)
4 % prefix to search for files, such as 'TIFs/'
5 % w file with extracted wrfout data, see detect_fit_level2
16 disp('Subset simulation domain and convert time')
21 red.tign_g = w.tign_g;
24 disp('Loading and subsetting detections')
26 p=sort_rsac_files(prefix);
27 time_bounds=subset_detection_time(red,p);
28 red.time_bounds=time_bounds;
29 g = load_subset_detections(prefix,p,red,time_bounds,fig);
31 %bypass the above line and load computed g
34 % Parameters of the objective function
35 % params.alpha=input_num('penalty coefficient alpha',1/1000);
36 % TC = W/(900*24); % time constant = fuel gone in one hour
38 params.TC = 1/24; % detection time constants in hours
40 %edit the next three lines to remove use input
41 %params.stretch=input_num('Tmin,Tmax,Tneg,Tpos',[0.5,10,5,10]);
42 %params.weight=input_num('water,land,low,nominal,high confidence fire',...
43 % [-10,-10,0.2,0.6,1]);
44 %params.power=input_num('correction smoothness',1.02);
45 params.stretch=[0.5,10,5,10];
46 params.weight= [-10,-10,0.2,0.6,1];
54 % objective function is penalty minus log likelihood -> min
55 J=-detection_objective(red.tign,0,g,params,red);
56 % new likelihood stand-in
57 J = new_objective(w,red,g);
59 s=sprintf('Data log likelihood %18.11e',J);
60 plot_state(fig.fig_state,red,s,red.tign,g,time_bounds(1:2));