function [xg,yg,varg1,varg2,varg3]=...
    slicecomp3(cruise,clev1,clev2,clev3,depth,itype);
% makes 3 panel plot of alexandrium, salinity and temperature
% from cruise data.  Shells out to zgrid FORTRAN program
% to grid scattered data.

% load coastline (km) & snip off part on the east
load /usr/users/rps/gom/dino/wgom_half
ind=find(coast(:,1)>370);
coast(ind,:)=[];
coast(1,:)=[];

%load /usr/users/rps/gom/dino/gom2.dig.sp

%coast=[coast; nan nan; gom2(:,[1 2])/1000];
set(gcf,'pos',[30 30 620 480]);
eval(['load ' cruise ]);

start=greg2str(gregorian(min(jd(:))));
stop=greg2str(gregorian(max(jd(:))));
titl=['DATA section at ' int2str(depth) ' m : '];
titl=[titl start(1:10) '-' stop(1:10)];
var1='alex0';
idepth=1;
iflip1=0;
eval(['v = ' var1 '(idepth,:)']);
data=[x(:)*1000 y(:)*1000 v(:)];
ind=find(isnan(v(:)));
data(ind,:)=[];

save lev.dat depth /ascii
save temp.dat data /ascii
!/usr/users/rps/gom/dino/dogridgen
varg1=mcvgt('temp.cdf','var');
ind=find(varg1>1e16);
varg1(ind)=varg1(ind)*nan;
xg=mcvgt('temp.cdf','x');
yg=mcvgt('temp.cdf','y');

var2='salt';
idepth=abs(depth)*2;
iflip2=1;
eval(['v = ' var2 '(idepth,:)']);
data=[x(:)*1000 y(:)*1000 v(:)];
ind=find(isnan(v(:)));
data(ind,:)=[];
save temp.dat data /ascii
!/usr/users/rps/gom/dino/dogridgen
varg2=mcvgt('temp.cdf','var');
ind=find(varg2>1e16);
varg2(ind)=varg2(ind)*nan;
xg=mcvgt('temp.cdf','x');
yg=mcvgt('temp.cdf','y');

var3='temp';
idepth=abs(depth)*2;
iflip3=0;
eval(['v = ' var3 '(idepth,:)']);
data=[x(:)*1000 y(:)*1000 v(:)];
ind=find(isnan(v(:)));
data(ind,:)=[];
save temp.dat data /ascii
!/usr/users/rps/gom/dino/dogridgen
varg3=mcvgt('temp.cdf','var');
ind=find(varg3>1e16);
varg3(ind)=varg3(ind)*nan;
xg=mcvgt('temp.cdf','x');
yg=mcvgt('temp.cdf','y');

%         itype :  1= fill, label 
%                  2= fill, no label
%                  3= nofill, label
%
clf
if(exist('itype')~=1),
 itype=1;
end
colormap(jet(64));
if(iflip1),
  varg1=max(clev1)-(varg1-min(clev1));
end
if(iflip2),
  varg2=max(clev2)-(varg2-min(clev2));
end
if(iflip3),
  varg3=max(clev3)-(varg3-min(clev3));
end

% panel 1
axes('pos',[.0 .1 .4 .8]);
cax=[min(clev1) max(clev1)];
if(itype==1),
  pslice2(xg/1000,yg/1000,varg1,[min(clev1) max(clev1)]);...
  line(coast(:,1),coast(:,2),'color','white');...
  line(data(:,1)/1000,data(:,2)/1000,'color',[1.0 1.0 .99],'linestyle','x');...
  set(gca,'asp',[nan 1]);
elseif(itype==2),
  extcontour(xg/1000,yg/1000,varg1,clev1,'fill');...
  line(coast(:,1),coast(:,2),'color','white');...
  set(gca,'asp',[nan 1]);
elseif(itype==3),
  extcontour(xg/1000,yg/1000,varg1,clev1,'label');...
  line(coast(:,1),coast(:,2),'color','white');...
  set(gca,'asp',[nan 1]);
else
  disp('invalid itype');
  return
end
text(300,380,titl,'FontWeight','bold');
text(260,360,'Cells (#/liter)','FontWeight','bold');
set(gca,'visible','off');
%  hh=gca;
%  dif=max(clev1)-min(clev1);
%  mid=floor(dif/2);
%  inc=floor(dif/2)/5;
%  hb=cbar(hh,'h',inc,mid,'fontsize',9);
%  axes(hh);

%panel2
axes('pos',[.3 .1 .4 .8]);
colormap(jet(64));
if(itype==1),
  pslice2(xg/1000,yg/1000,varg2,[min(clev2) max(clev2)]);...
  line(data(:,1)/1000,data(:,2)/1000,'color',[1.0 1.0 .99],'linestyle','x');...
  line(coast(:,1),coast(:,2),'color','white');...
  set(gca,'asp',[nan 1]);
elseif(itype==2),
  extcontour(xg/1000,yg/1000,varg2,clev2,'fill');...
  line(coast(:,1),coast(:,2),'color','white');...
  set(gca,'asp',[nan 1]);
elseif(itype==3),
  extcontour(xg/1000,yg/1000,varg2,clev2,'label');
  line(coast(:,1),coast(:,2),'color','white');...
  set(gca,'asp',[nan 1]);
else
  disp('invalid itype');
  return
end
text(270,360,'Salinity (psu)','FontWeight','bold');
set(gca,'visible','off');
%  hh=gca;
% dif=max(clev3)-min(clev3);
%  mid=floor(dif/2);
%  inc=floor(dif/2)/5;
%  hb=cbar(hh,'h',inc,mid,'fontsize',9);
%  axes(hh);

%panel3
axes('pos',[.6 .1 .4 .8]);
colormap(jet(64));
if(itype==1),
  pslice2(xg/1000,yg/1000,varg3,[min(clev3) max(clev3)]);...
  line(data(:,1)/1000,data(:,2)/1000,'color',[1.0 1.0 .99],'linestyle','x');...
  line(coast(:,1),coast(:,2),'color','white');...
  set(gca,'asp',[nan 1]);
elseif(itype==2),
  extcontour(xg/1000,yg/1000,varg3,clev3,'fill');...
  line(coast(:,1),coast(:,2),'color','white');...
  set(gca,'asp',[nan 1]);
elseif(itype==3),
  extcontour(xg/1000,yg/1000,varg3,clev3,'label');
  line(coast(:,1),coast(:,2),'color','white');...
  set(gca,'asp',[nan 1]);
else
  disp('invalid itype');
  return
end
text(270,360,'Temperature (C)','FontWeight','bold');
set(gca,'visible','off');
%  hh=gca;
%  dif=max(clev3)-min(clev3);
  %mid=floor(dif/2);
%  inc=floor(dif/2)/5;
%  hb=cbar(hh,'h',inc,mid,'fontsize',9);
  %axes(hh);

% colorbar
pclegend(clev1',[.07 .7 .02 .2]);
pclegend(clev2,[.35 .05 .18 .02]);
set(gca,'xticklabels',['33';'31';'29'])
pclegend(clev3',[.94 .3 .02 .2]);

