Documentation of map_surface_interp


Global Index (all files) (short | long) | Local Index (files in subdir) (short | long)


Function Synopsis

h = map_surface(varargin);

Help text


  h = map_surface(data, alt, 'PropertyName', ProptertyValue, ...);

  This function uses the surfacem routine in the map
  toolbox to generate a color-shaded surface.  The
  'facecolor' property is set to 'interp', which produces
  a smooth-looking map.

  If alt is specified, then surfacem will produce the
  map at the Z-altitude specified in alt.  Otherwise,
  the routine uses Z=0 for an altitude.


Cross-Reference Information

This function calls This function is called by

Listing of function map_surface_interp

function h = map_surface(varargin);

%  Dan Vimont, 2 September, 1999

if nargin == 1
     data = varargin{1};
     alt = zeros(size(data));
     varargin(1) = [];

else
     data = varargin{1};
  
     if ~isstr(varargin{2}); 
         alt = varargin{2};
         varargin(1:2) = [];
     else
         alt = zeros(size(data));
         varargin(1) = [];
     end
     
end

data = squeeze(data);
alt = squeeze(alt);

if isscalar(alt);
     alt = alt*ones(size(data));
end

%  First, determine if hold is 'on', or 'off'.

next_ax = lower(get(gca, 'NextPlot'));
if strcmp(next_ax, 'replace');  cla;  end;

%  Get the global varaibles XAX YAX and FRAME

global XAX YAX FRAME
if (size(XAX, 1) == 1); XAX = XAX'; end;
if (size(YAX, 1) == 1); YAX = YAX'; end;

[m, n] = size(data);
if or((m~=length(YAX)), (n~=length(XAX)));
  error('[length(YAX) length(XAX)] must equal size(data)');
end

%  Redefine XAX, YAX and data for global contouring -- allowing 
%  for wrapping around the globe.

[xk, yk] = keep_var(FRAME, XAX, YAX);
if (FRAME(2) - FRAME(1) == 360);
  data2 = [data(yk,:) data(yk,1)];
  alt2 = [alt(yk,:) alt(yk,1)];
  XAX2 = [XAX; XAX(1)+360];
else
  data2 = data(yk, xk);
  alt2 = alt(yk, xk);
  XAX2 = XAX(xk);
end;
YAX2 = YAX(yk);

[nlat, nlon] = size(data2);
XAX2 = ones(nlat,1)*XAX2';
YAX2 = YAX2*ones(1,nlon);

if isempty(find(~isnan(data2))); return; end;

%  Plot the data

hndl0 = surfacem(YAX2, XAX2, data2, alt2);

set(hndl0, 'facecolor', 'interp');
if ~isempty(varargin);  set(hndl0,varargin{:});  end

if nargout == 1;
    h = hndl0;
end

set(gca, 'NextPlot', next_ax);