function dat_plot(cnv_var)
% - 	subplots of temperature, conductivity and salinity
% 
% CTD Calibration toolbox.
%
% INPUT
%	
% OUTPUT
%	
%USAGE -	
%
%EXPLANATION -	
%
%SEE ALSO -	
%

%AUTHORS - 	MATLAB code by c.m.duncombe rae
%
%CREATED -	
%  2008/03/20
%
% VERSION:
%	$Revision: 1.1 $
%	$Date: 2008/03/25 16:32:57 $
%	$Id: dat_plot.m,v 1.1 2008/03/25 16:32:57 duncombe Exp duncombe $
%
%CHANGELOG -	
%  2008/03/25 CMDR 
% 	* turn it into a function
%
%

if ~exist('cruiseid'), cruiseid=getcruiseid; end;
if isempty(cruiseid), cruiseid=getcruiseid; end;

% Retrieve the necessary preferences for this cruise
group = group_name(cruiseid);

%%%%%
%%%%% 
%%%%%
%%%%%
%% 
% investigate linkaxes and pan


for i=1:length(cnv_var),

% these are for cnv_load, cnv_fill
	if isfield(cnv_var,'station'), stn{i}=cnv_var(i).station; end; 
	if isfield(cnv_var,'pressure'), P{i}=cnv_var(i).pressure; end; 
	if isfield(cnv_var,'temppri'), T{i}=cnv_var(i).temppri; end; 
	if isfield(cnv_var,'condpri'), C{i}=cnv_var(i).condpri; end; 
	if isfield(cnv_var,'salpri'), S{i}=cnv_var(i).salpri; end;
	if isfield(cnv_var,'thetapri'), Th{i}=cnv_var(i).thetapri; end;

% this is just in case
	% if isfield(cnv_var,'theta'), Th{i}=cnv_var(i).theta; end;

% these are for dat_load
	if isfield(cnv_var,'temp1'), T{i}=cnv_var(i).temp1; end; 
	if isfield(cnv_var,'cond1'), C{i}=cnv_var(i).cond1; end; 
	if isfield(cnv_var,'salt1'), S{i}=cnv_var(i).salt1; end;
	if isfield(cnv_var,'scanno'), scan{i}=cnv_var(i).scanno; end;

% These are backup for when the parameter does not exist and can be estimated
	if ~isfield(cnv_var,'theta') & ~isfield(cnv_var,'thetapri'),
		Th{i}=sw_ptmp(S{i},T{i},P{i},0);
	end;

	axh=0; nsp=4;
	figure;
		axh=axh+1;
		ax(axh)=subplot(nsp,1,axh);
		plot(scan{i},T{i});
		hold on;
		plot(scan{i},T{i},'.');
		title(['Temperature: Station ' num2str(stn{i})]);

		axh=axh+1;
		ax(axh)=subplot(nsp,1,axh);
		plot(scan{i},C{i});
		hold on;
		plot(scan{i},C{i},'.');
		title(['Conductivity: Station ' num2str(stn{i})]);

		axh=axh+1;
		ax(axh)=subplot(nsp,1,axh);
		plot(scan{i},S{i});
		hold on;
		plot(scan{i},S{i},'.');
		title(['Salinity: Station ' num2str(stn{i})]);

		axh=axh+1;
		ax(axh)=subplot(nsp,1,axh);
		plot(scan{i},P{i});
		hold on;
		plot(scan{i},P{i},'.');
		title(['Pressure: Station ' num2str(stn{i})]);

		linkaxes(ax,'x');
		zoom on;
end;


