function cstwplt(vgrr,nn,mm,hz,ng,as)

%  Plot seamount-trapped wave eigenfunctions as contours	9/1/97
%  Uses output from bigsmpd 
%  	but the flat file version (mm,nn stripped off at beginning)
%  Call as
%	 cstwplt(vgrr,nn,mm,hz,ng,as)
%  Where
%	nn,mm = # of r,z grid points of computed field
%		mm must be as in bigsmpd, nn can be less than in bigsmpd
%	hz = seamount depth (m) at r = 0 (hz>0)
%	ng = number of vertical grid points to interpolate to
%	vgrr= Bigsmpd graphics output
%	as = 0 for no autoscale, as ~= 0 for autoscale max
%
%  For Matlab for Windows 4.0 or better

nc = 10;
%	nc = number of positive and/or negative contours 

grzz = NaN*ones(ng,nn);

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

yy = min(vgrr(:,2));
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;
grbt = [[0 -hz]' grbt']';


ax = [0  xx  yy 0];

cc = max(abs(vgrr(:,3)));

if as ~= 0
	grzz = as*grzz/cc;
	cc =as;	
end	


ci = cc/nc;
cp = (1:nc)*ci;
cm = -cp;
cz = (ci/10000)*ones(2,1);
['Contour Interval = '  num2str(ci)]

C= contour(grxx,gryy,grzz,cp);

axis(ax)
hold on

CC = contour(grxx,gryy,grzz,cm,'-.');
CCC = contour(grxx,gryy,grzz,cz,'--');

if as ~= 0
%	clabel(C)
%	clabel(CC)
end

plot(grbt(:,1),grbt(:,2))
xlabel('Radius (km)')
ylabel('Depth (m)')

hold off