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

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

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


Revision 1.1 - (hide annotations) (download)
Tue Sep 11 15:15:19 2012 UTC (12 years, 10 months ago) by gforget
Branch: MAIN
- convert2widefaces.m (new routine)
    allows for use MITgcm outputs with removed/truncated faces.
- convert2gcmfaces.m
    use pre-defined mygrid.facesSize (from grid_load.m)
    if mygrid.facesExpand then call convert2widefaces.m (new routine)
- grid_load.m
    added optional argument memoryLimit (set to >0 to save memory/space)
    added definition of mygrid.ioSize, facesSize, and facesExpand
        They are used in convert2gcmfaces.m and convert2widefaces.m
        They may be read from [dirGrid 'grid.specs.mat'] but in all
        standard setups they will be determined automatically.
    added gcmfaces_lines_zonal and gcmfaces_lines_transp calls (from basic_diags_ecco)

1 gforget 1.1 function [v0]=convert2widefaces(v0);
2     %object: when mygrid.facesSize is non standard (i.e.
3     % some faces were troncated in the files) this
4     % routine expands them back to dimensions that
5     % allow e.g. the exchanges to work
6    
7     gcmfaces_global;
8    
9     if ~isempty(mygrid.facesExpand);
10    
11     nn=mygrid.facesExpand(1); mm=mygrid.facesExpand(2);
12     widefacesSize=[[nn mm];[nn mm];[nn nn];[mm nn];[mm nn]];
13    
14     v0facesSize=[size(v0{1});size(v0{2});size(v0{3});size(v0{4});size(v0{5})];
15     v0facesSize=v0facesSize(:,1:2);
16    
17     test0=0<sum(abs(prod(mygrid.facesSize,2)-prod(v0facesSize,2)));
18     test1=0<sum(abs(prod(widefacesSize,2)-prod(v0facesSize,2)));
19     if (test0&test1)|(~test0&~test1);
20     error('inconsitent size');
21     end;
22    
23     if test1;%the expand faces
24     for iFace=1:mygrid.nFaces;
25     ii=size(v0{iFace}); ii(1:2)=widefacesSize(iFace,:);
26     tmp1=NaN*zeros(ii);
27     if iFace==1|iFace==2;%fill the Northern part of faces 1 and 2
28     jj=[widefacesSize(iFace,2)-v0facesSize(iFace,2)+1:widefacesSize(iFace,2)];
29     else;
30     jj=[1:v0facesSize(iFace,2)];
31     end;
32     ii=[1:v0facesSize(iFace,1)];
33     tmp1(ii,jj,:)=v0{iFace};
34     v0{iFace}=tmp1;
35     end;
36     else;%then truncate faces
37     for iFace=1:mygrid.nFaces;
38     if iFace==1|iFace==2;%truncate the Southern part of faces 1 and 2
39     jj=[widefacesSize(iFace,2)-mygrid.facesSize(iFace,2)+1:widefacesSize(iFace,2)];
40     else;
41     jj=[1:mygrid.facesSize(iFace,2)];
42     end;
43     ii=[1:mygrid.facesSize(iFace,1)];
44     v0{iFace}=v0{iFace}(ii,jj,:);
45     end;
46     end;
47    
48     end;

  ViewVC Help
Powered by ViewVC 1.1.22