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

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

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


Revision 1.3 - (hide 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: +1 -4 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 gforget 1.1 function [X,Y,FLD]=convert2pcol_llc(x,y,fld,varargin);
2 gforget 1.2 %object: gcmfaces to 'pcolor format' conversion
3     %inputs: x is longitude (e.g. mygrid.XC)
4     % y is latitude (e.g. mygrid.YC)
5     % fld is the 2D field of interest (e.g. mygrid.hFacC(:,:,1))
6     %outputs: X,Y,FLD are array versions of x,y,fld
7     %
8     %note: this function is designed so that one may readily
9     % plot the output in geographic coordinates
10     % using e.g. 'figure; pcolor(X,Y,FLD);'
11 gforget 1.1
12 gforget 1.2 k3=1; k4=1;
13 gforget 1.1
14     %ASSEMBLE "LATLON" FACES:
15     %----------------------
16     X=[x{1};x{2};sym_g(x{4},7,0); sym_g(x{5},7,0)];
17     Y=[y{1};y{2};sym_g(y{4},7,0); sym_g(y{5},7,0)];
18     FLD=[fld{1}(:,:,k3,k4);fld{2}(:,:,k3,k4);sym_g(fld{4}(:,:,k3,k4),7,0);sym_g(fld{5}(:,:,k3,k4),7,0)];
19    
20     %ADD POLAR CAP:
21     %--------------
22     pp=x{3};
23     M1=pp; M1(M1>M1(1,1))=NaN; M1(M1<M1(1,end))=NaN; M1(~isnan(M1))=1;
24     %M1=NaN*pp;
25     %M2=pp; M2(M2<M2(1,1))=NaN; M2(M2>M2(end,1))=NaN; M2(~isnan(M2))=1;
26     M2=pp; M2(pp<0)=NaN; M2(pp>=0)=1;
27     M3=pp; M3(M3<M3(end,1)&M3>M3(end,end))=NaN; M3(~isnan(M3))=1;
28     %M3=NaN*pp;
29     %M4=pp; M4(M4<M4(end,end))=NaN; M4(M4>M4(1,end))=NaN; M4(~isnan(M4))=1;
30     M4=pp; M4(pp>=0)=NaN; M4(pp<0)=1;
31    
32     pp=x{3}; Xp=[sym_g(pp.*M1,5,0);pp.*M2;sym_g(pp.*M3,7,0);sym_g(pp.*M4,6,0)]; X=[X Xp];
33     pp=y{3}; Yp=[sym_g(pp.*M1,5,0);pp.*M2;sym_g(pp.*M3,7,0);sym_g(pp.*M4,6,0)]; Y=[Y Yp];
34     pp=fld{3}(:,:,k3,k4); FLDp=[sym_g(pp.*M1,5,0);pp.*M2;sym_g(pp.*M3,7,0);sym_g(pp.*M4,6,0)]; FLD=[FLD FLDp];
35    
36     %FIX DATE CHANGE LINE IN LATLON PART:
37     %--------------------------------------
38     s1=size(X); s1=round(s1(2)/2); s2=find(diff(X(:,s1))<-180);
39     X=circshift(X,[-s2 0]);
40     Y=circshift(Y,[-s2 0]);
41     FLD=circshift(FLD,[-s2 0]);
42    
43     %ADD POINTS TO FIX DATE CHANGE LINE ELSEWHERE:
44     %---------------------------------------------
45     s1=size(X); s1=round(s1(1)/12);
46     tmp1=X(1:2*s1,:); tmp1(tmp1>0)=tmp1(tmp1>0)-360; X(1:2*s1,:)=tmp1;
47     tmp1=X(end-2*s1+1:end,:); tmp1(tmp1<0)=tmp1(tmp1<0)+360; X(end-2*s1+1:end,:)=tmp1;
48    
49 gforget 1.3 X=[X-360;X;X+360]; Y=[Y;Y;Y]; FLD=[FLD;FLD;FLD];
50 gforget 1.1

  ViewVC Help
Powered by ViewVC 1.1.22