/[MITgcm]/MITgcm_contrib/gael/matlab_class/gcmfaces_IO/check_mygrid.m
ViewVC logotype

Annotation of /MITgcm_contrib/gael/matlab_class/gcmfaces_IO/check_mygrid.m

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (hide annotations) (download)
Sun Jan 10 17:05:58 2016 UTC (9 years, 6 months ago) by gforget
Branch: MAIN
CVS Tags: checkpoint65x, checkpoint65v, checkpoint65w, checkpoint65t, checkpoint65u, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint66o, HEAD
- convert2gcmfaces.m: treat case when mygrid.fileFormat is 'nctiles'
- grid_load.m: assume llc90 is used if no input parameters; treat case
  when mygrid.fileFormat is 'nctiles' (when nctiles_grid is found).
- check_mygrid.m: compare two versions of mygrid.

1 gforget 1.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    

  ViewVC Help
Powered by ViewVC 1.1.22