1 |
gforget |
1.1 |
function [X,Y,FLD]=convert2pcol_ll(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 |
|
|
global regularizeXC; |
15 |
|
|
if isempty(regularizeXC); |
16 |
|
|
fprintf('\n\nconvert2pcol_ll.m init: by default gcmfaces assumes\n'); |
17 |
|
|
fprintf(' that XC is longitude in the [-180 180] range, and \n'); |
18 |
|
|
fprintf(' if XC shows values outside this range, gcmfaces \n'); |
19 |
|
|
fprintf(' will to enforce this convention in graphs. If this is \n'); |
20 |
|
|
fprintf(' inadequate, you may try to set regularizeXC to 0 below \n\n'); |
21 |
|
|
regularizeXC=1; |
22 |
|
|
end; |
23 |
|
|
|
24 |
|
|
%ASSEMBLE "LATLON" FACES: |
25 |
|
|
%---------------------- |
26 |
|
|
X=x{1}; Y=y{1}; FLD=fld{1}(:,:,k3,k4); |
27 |
|
|
|
28 |
|
|
%FIX DATE CHANGE LINE IN LATLON PART: |
29 |
|
|
%-------------------------------------- |
30 |
|
|
if regularizeXC; |
31 |
|
|
ii=max(find(X(:,1)<=180)); |
32 |
|
|
X=circshift(X,[-ii 0]); X(X>180)=X(X>180)-360; |
33 |
|
|
Y=circshift(Y,[-ii 0]); |
34 |
|
|
FLD=circshift(FLD,[-ii 0]); |
35 |
|
|
end; |
36 |
|
|
|