Merge branch 'master' of github.com:openwfm/wrf-fire-matlab
[wrf-fire-matlab.git] / vis / compareto.m
blob2a2d1d75d162d5cf0334f6d5bdf63b358c0c44df
1 function maxerr=compareto(d1,pat)\r
2 if ~exist('pat','var'),pat=['*_0*.txt'],end\r
3 f=dir(pat);\r
4 n=length(f);\r
5 err=zeros(n);\r
6 for i=1:n\r
7     name=f(i).name;\r
8     try\r
9         v=read_array_m([name]);\r
10         v1=read_array_m([d1,'/',name]);\r
11         vdiff=v(:)-v1(:);\r
12         sz=(max(abs(v(:)))+max(abs(v1(:))))*0.5;\r
13         maxadiff=max(abs(vdiff));\r
14         meandiff=mean(vdiff);\r
15         stddiff=std(vdiff);\r
16         reladiff=maxadiff/sz;\r
17         err(i)=reladiff;\r
18         fprintf('%s diff: max abs %g mean %g std %g max abs rel %g\n',...\r
19             name,maxadiff,meandiff,stddiff,reladiff)\r
20     catch\r
21         disp(['comparison of ',name,' failed'])\r
22     end\r
23 end\r
24 maxerr=max(err);\r
25 end