function [fh]=plot_all(cruises)
%PLOT_ALL - plot entire cruises on the same axes
%
%CTD Calibration toolbox.
%
%INPUT
%	cell structure of cruiseids to plot
%
%OUTPUT
%	
%USAGE -	plot_all(cruises)
%
%EXPLANATION -	
%
%SEE ALSO -	
%

%AUTHORS - 	MATLAB code by c.m.duncombe rae
%
%CREATED - 2008/02/22
%
%VERSION:
%	$Revision: 1.7 $
%	$Date: 2008/03/26 15:36:51 $
%	$Id: plot_all.m,v 1.7 2008/03/26 15:36:51 duncombe Exp duncombe $
%
%CHANGE_LOG
%  2008/03/09 CMDR
%	* make the variable names more meaningful
% 	* need more variables plotted
%  2008/03/14 CMDR
%	* turn the script into a function
%  2008/03/23 CMDR 
%	* fixing typo
%

% cruises = { 'ws0402' 'ws0412' 'ws0415' };
if ~exist('cruises'), 
	disp(['Usage: ' mfilename '(cruises)']);
	disp(['where cruises is a cell structure of cruiseids']);
	return;
end;
if ~iscell(cruises), cruises=cellstr(cruises); end;

col='brgcmykbrgcmyk';

fcnt=0;

fcnt=fcnt+1; rawfsal=figure; fh(fcnt)=rawfsal; 
fcnt=fcnt+1; loadfsal=figure; fh(fcnt)=loadfsal;
fcnt=fcnt+1; calfsal=figure; fh(fcnt)=calfsal;
fcnt=fcnt+1; dlpfsal=figure; fh(fcnt)=dlpfsal;

fcnt=fcnt+1; rawfoxy=figure; fh(fcnt)=rawfoxy;
fcnt=fcnt+1; loadfoxy=figure; fh(fcnt)=loadfoxy;
fcnt=fcnt+1; calfoxy=figure; fh(fcnt)=calfoxy;
fcnt=fcnt+1; dlpfoxy=figure; fh(fcnt)=dlpfoxy;

for j=1:length(cruises),
   dumm=load_cruise(cruises{j});
   disp([cruises{j} ' loaded']);

%%%%%%%%%%
%% CNV_CAL
%%%%%%%%%%
   figure(calfsal);
   for i=1:length(dumm.cnv_cal),
      plot(dumm.cnv_cal(i).salt,dumm.cnv_cal(i).temp,col(j));
      hold on;
   end;
   ccs(j)=plot(dumm.cond_match.btlsal,dumm.cond_match.ctdtmp1,[col(j) 'x']);

   figure(calfoxy);
   for i=1:length(dumm.cnv_cal),
      plot(dumm.cnv_cal(i).oxymll,dumm.cnv_cal(i).temp,col(j));
      hold on;
   end;
   cco(j)=plot(dumm.oxy_match.btloxy,dumm.oxy_match.ctdtmp1,[col(j) 'x']);

%%%%%%%%%%
%% CNV_DLP
%%%%%%%%%%
   figure(dlpfsal);
   for i=1:length(dumm.cnv_dlp),
      plot(dumm.cnv_dlp(i).salpri,dumm.cnv_dlp(i).temppri,col(j));
      hold on;
   end;
   cds(j)=plot(dumm.cond_match.btlsal,dumm.cond_match.ctdtmp1,[col(j) 'x']);

   figure(dlpfoxy);
   for i=1:length(dumm.cnv_dlp),
      plot(dumm.cnv_dlp(i).oxmllpri,dumm.cnv_dlp(i).temppri,col(j));
      hold on;
   end;
   cdo(j)=plot(dumm.oxy_match.btloxy,dumm.oxy_match.ctdtmp1,[col(j) 'x']);

%%%%%%%%%%%
%% CNV_LOAD
%%%%%%%%%%%
   figure(loadfsal);
   for i=1:length(dumm.cnv_load),
      plot(dumm.cnv_load(i).salpri,dumm.cnv_load(i).temppri,col(j));
      hold on;
   end;
   cls(j)=plot(dumm.cond_match.btlsal,dumm.cond_match.ctdtmp1,[col(j) 'x']);

   figure(loadfoxy);
   for i=1:length(dumm.cnv_load),
	if ~isempty(dumm.cnv_load(i).oxmllpri),
      plot(dumm.cnv_load(i).oxmllpri,dumm.cnv_load(i).temppri,col(j));
	end;
      hold on;
   end;
   clo(j)=plot(dumm.oxy_match.btloxy,dumm.oxy_match.ctdtmp1,[col(j) 'x']);

%%%%%%%%%%%
%% RAW_LOAD
%%%%%%%%%%%
   figure(rawfsal);
   for i=1:length(dumm.raw_load),
      plot(dumm.raw_load(i).salpri,dumm.raw_load(i).temppri,col(j));
      hold on;
   end;
   rls(j)=plot(dumm.cond_match.btlsal,dumm.cond_match.ctdtmp1,[col(j) 'x']);

   figure(rawfoxy);
   for i=1:length(dumm.raw_load),
	if ~isempty(dumm.raw_load(i).oxmllpri),
      plot(dumm.raw_load(i).oxmllpri,dumm.raw_load(i).temppri,col(j));
	end;
      hold on;
   end;
   rlo(j)=plot(dumm.oxy_match.btloxy,dumm.oxy_match.ctdtmp1,[col(j) 'x']);

end;

%%%%%%%%%%%%%%%%%%%%%%%%%
%% add legends and titles
%%%%%%%%%%%%%%%%%%%%%%%%%

figure(calfsal);
	ax=axis;
	legend(ccs,cruises,'location','Best');
	xlabel('Salinity');
	ylabel('Temperature');
	title('Calibrated data (cnv\_cal)');

figure(dlpfsal);
	ax=axis;
	legend(cds,cruises,'location','Best');
	xlabel('Salinity');
	ylabel('Temperature');
	title('Delooped data (cnv\_dlp)');

figure(loadfsal);
	axis(ax);
	legend(cls,cruises,'location','Best');
	xlabel('Salinity');
	ylabel('Temperature');
	title('Uncalibrated data (cnv\_load)');

figure(rawfsal);
	axis(ax);
	legend(rls,cruises,'location','Best');
	xlabel('Salinity');
	ylabel('Temperature');
	title('Uncalibrated data (raw\_load)');


figure(calfoxy);
	ax=axis;
	legend(cco,cruises,'location','Best');
	xlabel('Oxygen');
	ylabel('Temperature');
	title('Calibrated data (cnv\_cal)');

figure(dlpfoxy);
	ax=axis;
	legend(cdo,cruises,'location','Best');
	xlabel('Oxygen');
	ylabel('Temperature');
	title('Delooped data (cnv\_dlp)');

figure(loadfoxy);
	axis(ax);
	legend(clo,cruises,'location','Best');
	xlabel('Oxygen');
	ylabel('Temperature');
	title('Uncalibrated data (cnv\_load)');

figure(rawfoxy);
	axis(ax);
	legend(rlo,cruises,'location','Best');
	xlabel('Oxygen');
	ylabel('Temperature');
	title('Uncalibrated data (raw\_load)');

return;
