Global Index (short | long) | Local contents | Local Index (short | long)
[h, c]=gcont(var, clev1, zero);
function [h, c]=gcont(var, clev) This function contours the variable 'var' over the global grid, with contour interval specified by clev, and axis limits [0 360 -90 90] unless otherwise specified.
function [h, c]=gcont(var, clev1, zero);
var = squeeze(var);
global XAX YAX FRAME
% set axis parameters:
if nargin < 2;
error('clev needs to be input');
end;
if nargin < 3; zero = 0; end;
if isscalar(clev1);
clev = sort([-clev1:-clev1:min(min(var)) clev1:clev1:max(max(var))]);
if zero; clev = sort([clev 0]); end
else
clev = clev1;
end
if isscalar(clev);
clev = [-clev1 clev1];
end
if FRAME(1) > FRAME(2);
FRAME2 = [FRAME(1) FRAME(2)+360 FRAME(3:4)];
temx = [XAX(find(XAX > FRAME(1))); XAX(find(XAX < FRAME(2)))+360];
else
FRAME2 = FRAME;
temx = XAX;
end
[xk, yk] = keep_var2(FRAME2, temx, YAX);
% Get the variable in the frame you want it in
if (FRAME(2)-FRAME(1))==360.;
if size(temx, 2) == 1;
XAX2 = [temx; temx(1)+360.];
else
XAX2 = [temx temx(1)+360.];
end
YAX2 = YAX(yk);
var = [var(yk,:) var(yk,1)];
else
XAX2 = temx(xk);
YAX2 = YAX(yk);
var = var(yk, xk);
end;
% Contour the data
[h, c] = pncont(XAX2, YAX2, var, clev, 0, ['k']);
axis(FRAME2)