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 |
|
|
X=[X(end-s1+1:end,:);X;X(1:s1,:)]; |
47 |
|
|
Y=[Y(end-s1+1:end,:);Y;Y(1:s1,:)]; |
48 |
|
|
FLD=[FLD(end-s1+1:end,:);FLD;FLD(1:s1,:)]; |
49 |
|
|
|
50 |
|
|
tmp1=X(1:2*s1,:); tmp1(tmp1>0)=tmp1(tmp1>0)-360; X(1:2*s1,:)=tmp1; |
51 |
|
|
tmp1=X(end-2*s1+1:end,:); tmp1(tmp1<0)=tmp1(tmp1<0)+360; X(end-2*s1+1:end,:)=tmp1; |
52 |
|
|
|
53 |
|
|
|