1 |
|
2 |
%expected result: |
3 |
% |
4 |
%difference in dirGrid |
5 |
%difference in fileFormat |
6 |
%difference in RF |
7 |
%structure LATS_MASKS remains to be checked |
8 |
%structure LINES_MASKS remains to be checked |
9 |
|
10 |
clear all; |
11 |
|
12 |
load mygrid_nctiles.mat; |
13 |
%load mygrid_new.mat; |
14 |
mygrid1=mygrid; mygrid=[]; |
15 |
load mygrid_old.mat; |
16 |
mygrid2=mygrid; mygrid=[]; |
17 |
|
18 |
list1=fieldnames(mygrid1); |
19 |
list2=fieldnames(mygrid2); |
20 |
if length(list1)~=length(list2); |
21 |
error('missing variables'); |
22 |
end; |
23 |
|
24 |
for ii=1:length(list1); |
25 |
if sum(strcmp(list2,list1{ii}))~=1; |
26 |
error('missing variable'); |
27 |
end; |
28 |
tmp1=getfield(mygrid1,list1{ii}); |
29 |
tmp2=getfield(mygrid2,list1{ii}); |
30 |
if ischar(tmp1); |
31 |
if ~strcmp(tmp1,tmp2); fprintf(['\n difference in ' list1{ii} '\n']); end; |
32 |
elseif isstruct(tmp1); |
33 |
fprintf(['\n structure ' list1{ii} ' remains to be checked\n']); |
34 |
%disp(tmp1); disp(tmp2); |
35 |
elseif isnumeric(tmp1); |
36 |
if sum(size(tmp1)~=size(tmp2))>0; |
37 |
fprintf(['\n size difference in ' list1{ii} '\n']); |
38 |
else; |
39 |
tmp3=max(abs(tmp1(:)-tmp2(:))); |
40 |
tmp4=max(abs(isnan(tmp1(:))-isnan(tmp2(:)))); |
41 |
if tmp3~=0|tmp4~=0; fprintf(['\n difference in ' list1{ii} '\n']); end; |
42 |
end; |
43 |
elseif islogical(tmp1)|isa(tmp1,'gcmfaces'); |
44 |
tmp3=max(abs(tmp1(:)-tmp2(:))); |
45 |
tmp4=max(abs(isnan(tmp1(:))-isnan(tmp2(:)))); |
46 |
if tmp3~=0|tmp4~=0; fprintf(['\n difference in ' list1{ii} '\n']); end; |
47 |
else; |
48 |
error('missing type'); |
49 |
end; |
50 |
end; |
51 |
|