/[MITgcm]/MITgcm_contrib/gael/matlab_class/gcmfaces_convert/convert2array_llc.m
ViewVC logotype

Annotation of /MITgcm_contrib/gael/matlab_class/gcmfaces_convert/convert2array_llc.m

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


Revision 1.2 - (hide annotations) (download)
Tue Jun 21 21:19:27 2011 UTC (14 years, 1 month ago) by gforget
Branch: MAIN
Changes since 1.1: +9 -2 lines
- remove blueprint gcmfaces argument in accord with the convert2array.m revision.

1 gforget 1.2 function [FLD]=convert2array_llc(fld);
2     %object: gcmfaces to array format conversion (if gcmfaces input)
3     % or: array to gcmfaces format conversion (if array input)
4     %
5     %notes: if array input, the gcmfaces format will be the one of mygrid.XC, so
6     % the array input must have originally been created according to convert2array
7    
8     global mygrid;
9 gforget 1.1
10     if isa(fld,'gcmfaces'); do_gcmfaces2array=1; else; do_gcmfaces2array=0; end;
11    
12     if do_gcmfaces2array;
13     n3=max(size(fld.f1,3),1); n4=max(size(fld.f1,4),1);
14     n1=size(fld.f1,1)*4; n2=size(fld.f1,2)+size(fld.f1,1);
15     FLD=squeeze(zeros(n1,n2,n3,n4));
16     else;
17     n3=max(size(fld,3),1); n4=max(size(fld,4),1);
18 gforget 1.2 FLD=NaN*mygrid.XC;
19 gforget 1.1 for k3=1:n3; for k4=1:n4; for iFace=1:FLD.nFaces;
20     iF=num2str(iFace); eval(['FLD.f' iF '(:,:,k3,k4)=FLD.f' iF '(:,:,1,1);']);
21     end; end; end;
22     end;
23    
24     for k3=1:n3; for k4=1:n4;
25    
26     if do_gcmfaces2array;
27     %ASSEMBLE "LATLON" FACES:
28     %----------------------
29     FLD0=[fld.f1(:,:,k3,k4);fld.f2(:,:,k3,k4);sym_g(fld.f4(:,:,k3,k4),7,0);sym_g(fld.f5(:,:,k3,k4),7,0)];
30     %ADD POLAR CAP:
31     %--------------
32     pp=fld.f3(:,:,k3,k4); FLDp=[sym_g(pp,5,0);pp.*NaN;sym_g(pp.*NaN,7,0);sym_g(pp.*NaN,6,0)];
33     FLD1=[FLD0 FLDp];
34     %store:
35     %------
36     FLD(:,:,k3,k4)=FLD1;
37     else;
38     n1=size(FLD.f1,1); n2=size(FLD.f1,2);
39     FLD.f1(:,:,k3,k4)=fld(1:n1,1:n2,k3,k4);
40     FLD.f2(:,:,k3,k4)=fld(n1+[1:n1],1:n2,k3,k4);
41     FLD.f3(:,:,k3,k4)=sym_g(fld([1:n1],n2+1:n2+n1,k3,k4),7,0);
42     FLD.f4(:,:,k3,k4)=sym_g(fld(n1*2+[1:n1],1:n2,k3,k4),5,0);
43     FLD.f5(:,:,k3,k4)=sym_g(fld(n1*3+[1:n1],1:n2,k3,k4),5,0);
44     end;
45    
46     end; end;
47    

  ViewVC Help
Powered by ViewVC 1.1.22