    function [xi,yi,zi]=kontour(lon,lat,z,ngp,blk,v);

%    function kontour(lon,lat,z,[ngp],[blk],[v]);
%
%    A routine to grid in lat/lon space including
%      an irregular input,  blanking,  and call to "econtour"
%
%    ngp is the number of grid nodes (25x25 by default)
%    if blk==0 no blanking done
%    v is the contour level vector


%   make a grid and grid
%   first set default number of nodes
    if nargin<4;
     ngp=25;
    end;

    xi1=min(lon):range(lon)*(1/ngp):max(lon);
    yi1=min(lat):range(lat)*(1/ngp):max(lat);
    disp('Gridding in progress ...')
    [xi,yi,zi]=griddata(lon,lat,z,xi1,yi1');

    if nargin<5; blk=0;end;
    if blk>0;
%     blank out those points outside polygon
      if length(lon)<500;
        co=menu('Blanking may take time. Continue?','y','n');
        if co==1;
          [zi]=blankjm(lon,lat,xi1,yi1,zi,.025);
        end;
      end;
    end;
% contour
   if nargin > 5;
     econtour(xi,yi,zi,v,'fill','label',100,'fontsize',10,'color','k');
   else;
     econtour(xi,yi,zi,'fill','label',100,'fontsize',10,'color','k');
   end;
   hold on;

% add basemap
   georbat(1);


