cleanup
[wrf-fire-matlab.git] / debug / diff_runs.m
blob9f4f89014d16289a328e4f1d6ccc92a0d0b8a13e
1 function err=diff_runs(runs,vars,root,wrffile,timestep)
2 % test if runs give the same results
3 % example
4 %runs={'1x1','1x6','6x1','2x3','2x3','1x2','2x1'}
5 %vars={'UAH','VAH','UF','VF'}
6 %root='hill-';
7 %wrffile='wrfrst_d01_0001-01-01_00:01:00';
8 %diff_runs(runs,vars,root,wrffile,[])
9 %wrffile='wrfout_d01_2006-02-23_12:42:00'
10 %diff_runs(runs,vars,root,wrffile,1)
12 file=[root,runs{1},'/',wrffile];
13 p1=nc2struct(file,vars,{},timestep);
14 for i=2:length(runs)
15     run=runs{i};
16     file=[root,run,'/',wrffile];
17     p=nc2struct(file,vars,{},timestep);
18     for j=1:length(vars)
19         var=lower(vars{j});
20         e=big(getfield(p1,var)-getfield(p,var));
21         err(i,j)=e;
22     end
23 end
24 timestep
25 runs
26 err