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

Contents 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.3 - (show annotations) (download)
Sat Jan 18 21:11:00 2014 UTC (11 years, 6 months ago) by gforget
Branch: MAIN
CVS Tags: checkpoint65x, checkpoint65r, checkpoint65p, checkpoint65q, checkpoint65v, checkpoint65w, checkpoint65t, checkpoint65u, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint66o, HEAD
Changes since 1.2: +9 -16 lines
- convert2array.m : hook to xtrct
- convert2array_llc.m : remove loops for speed up
- convert2pcol.m : hook to xtrct
- convert2pcol_cube.m, convert2pcol_llc.m :
  replicate field to facilitate Pacific centric maps

1 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
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 FLD=repmat(NaN*mygrid.XC,[1 1 n3 n4]);
19 end;
20
21 if do_gcmfaces2array;
22 %ASSEMBLE "LATLON" FACES:
23 %----------------------
24 FLD0=[fld.f1(:,:,:,:);fld.f2(:,:,:,:);sym_g(fld.f4(:,:,:,:),7,0);sym_g(fld.f5(:,:,:,:),7,0)];
25 %ADD POLAR CAP:
26 %--------------
27 pp=fld.f3(:,:,:,:); FLDp=[sym_g(pp,5,0);pp.*NaN;sym_g(pp.*NaN,7,0);sym_g(pp.*NaN,6,0)];
28 FLD1=[FLD0 FLDp];
29 %store:
30 %------
31 FLD(:,:,:,:)=FLD1;
32 else;
33 n1=size(FLD.f1,1); n2=size(FLD.f1,2);
34 FLD.f1(:,:,:,:)=fld(1:n1,1:n2,:,:);
35 FLD.f2(:,:,:,:)=fld(n1+[1:n1],1:n2,:,:);
36 FLD.f3(:,:,:,:)=sym_g(fld([1:n1],n2+1:n2+n1,:,:),7,0);
37 FLD.f4(:,:,:,:)=sym_g(fld(n1*2+[1:n1],1:n2,:,:),5,0);
38 FLD.f5(:,:,:,:)=sym_g(fld(n1*3+[1:n1],1:n2,:,:),5,0);
39 end;
40

  ViewVC Help
Powered by ViewVC 1.1.22