gitinore *.txt files
[wrf-fire-matlab.git] / cycling / area_ellipse.m
blob44ba57223d77b89e3f6d87fa25e7598e08ccfb29
1 function a = area_ellipse(wrfout)
2 % function a = area_ellipse(wrfout)
3 % function for comparing area and orientations
4 %       of stellite data and model forecasts
5 % input:
6 %   wrfout     -  string, path to  wrfout file from wrf
7 % ouput:
8 %   a             struct with who knows what in it
10 [fire_name,save_name,prefix] = fire_choice()
12 w = read_wrfout_tign(wrfout);
13 red = subset_domain(w,1);
15 % figures
16 fig.fig_map=0;
17 fig.fig_3d=0;
18 fig.fig_interp=0;
21 time_bounds = [red.start_datenum red.end_datenum];
22 p = sort_rsac_files(prefix);
23 if ~exist('g_ellipse.mat','file')
24     g = load_subset_detections(prefix,p,red,time_bounds,fig);
25     save g_ellipse.mat g
26 else
27     load_new = input_num('re-load detections from scratch? ',0,1);
28     if load_new
29         g = load_subset_detections(prefix,p,red,time_bounds,fig);
30         save g_ellipse.mat g
31     else
32         load g_ellipse.mat
33     end
34 end
36 t = g(end).time;
37 %fite ellipse, plot results
38 figure(1)
39 e_data = detection_ellipse(g,red);
40 hold on
41 e_forecast = forecast_ellipse(red,t);
42 contour(red.fxlong,red.fxlat,red.tign,'k')
44 a.e_data = e_data;
45 a.e_forecast = e_forecast;
47 eig_data = diag(a.e_data.d);
48 eig_forecast = diag(a.e_forecast.d);
49 eig_ratio = eig_forecast./eig_data;
51 fprintf('Forecast Area / Sat Area  = %f \n',e_forecast.area/e_data.area);
52 fprintf('Forecast det  / Sat det   = %f \n',e_forecast.ellipse_area/e_data.ellipse_area);
53 fprintf('Forecast eigenvalues / Sat eignevalues %f   %f   \n',eig_ratio(1),eig_ratio(2));
56 end