Documentation of map_quiver

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

Function Synopsis

h = map_quiver(x, y, scale, nskip);

Help text

  h = map_quiver(xdat, ydat, scale, nskip);

  xdat, ydat = lon and lat components of vector
  scale:       if positive, stretch the result by 'scale'
               if negative, a vector of length 'scale' will be one
                  unit long.
  nskip:       Number of arrows to skip.

  This function uses the mapping toolbox to 'quiver' the
  input 'xdat, ydat' matries.  It assumes that the x and y axes
  are defined in the global variables XAX and YAX, 

Cross-Reference Information

This function calls

Listing of function map_quiver

function h = map_quiver(x, y, scale, nskip);

%  Dan Vimont, 2 September, 1999

if nargin < 4; nskip = 1; end;
if nargin < 3; scale = 1; end;
x = squeeze(x); y = squeeze(y);

%  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


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

if ~isequal(size(x), size(y));
    error('x and y must be the same size');

%  Set defaults

line_style = 'k';

%  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);
  x2 = [x(yk,:) x(yk,1)];
  y2 = [y(yk,:) y(yk,1)];
  XAX2 = [XAX; XAX(1)+360];
  x2 = x(yk,xk);
  y2 = y(yk,xk);
  XAX2 = XAX(xk);
YAX2 = YAX(yk);

%  Thin the data
x2 = thin(x2, nskip);
y2 = thin(y2, nskip);
XAX2 = thin(XAX2, nskip);
YAX2 = thin(YAX2, nskip);

XAX3 = ones(size(YAX2))*XAX2';
YAX3 = YAX2*ones(size(XAX2'));

%  Plot the data

h = quiverm2(YAX3, XAX3, x2, y2, scale);
set(h, 'color', 'k');

set(gca, 'NextPlot', next_ax);