function pctwplt(vgrr,nn,mm,ng)

%  Plot coastal-trapped wave eigenfunctions as colors	8/28/97
%  Uses output from bigload3
%  	but the flat file version (mm,nn stripped off at beginning)
%  Call as
%	 pctwplt(vgrr,nn,mm,ng)
%  Where
%	nn,mm = # of x,z grid points in computed field
%		mm must be as in bigload3, nn can be less than in bigload3
%	ng = number of vertical grid points to interpolate to
%	vgrr= Bigload3 output
%	
%  Draws a zero contour in white
%  For Matlab for Windows 4.0 or better



grzz = NaN*ones(ng,nn);

vgrr(:,1) = vgrr(:,1)/1e5;
vgrr(:,2) = vgrr(:,2)/100;

yy = min(vgrr(:,2));
xl = 0;
xh = max(vgrr(:,1));

dz = abs(yy)/(ng-1);
yi = (yy:dz:0)';
yi(ng) = 0;
gryy = yi;

for i = 1:nn
	il = 1 + (i-1)*mm;
	ih = mm*i;
	grbt(i,1) = vgrr(il,1);
	zq = vgrr(il:ih,3);
	yq = vgrr(il:ih,2);
	yq(mm) = 0;
	yqm = min(yq);
	ii = find(yi >= yqm);
	yyi = yi(ii);
	zzi = interp1(yq,zq,yyi);
	grzz(ii,i) = zzi;
	grbt(i,2) = min(yq);
end
	
grxx = grbt(:,1);
xx = xh;

ax = [xl  xx  yy 0];

cc = max(abs(vgrr(:,3)));
cz = (cc/100000)*ones(2,1);

pcolor(grxx,gryy,grzz)
shading('flat')

axis(ax)
hold on

CCC = contour(grxx,gryy,grzz,cz,'w');

plot(grbt(:,1),grbt(:,2),'k')
xlabel('Distance Offshore (km)')
ylabel('Depth (m)')
hold off

colorbar
% "Colorbar" should be commented out in Matlab 4.
% it does work fine in Matlab 5
