Home > ctdcal > splitcnv.m

splitcnv

PURPOSE ^

splitcnv: Split a cnv structure into upcast/downcast

SYNOPSIS ^

function varargout = splitcnv(cnv)

DESCRIPTION ^

 splitcnv: Split a cnv structure into upcast/downcast
 
 DESCRIPTION: 
   Splits the cnv structure returned from read_sbecnv, into two 
 structures containing the downcast and upcast respectively.
 The maximum pressure is used as the point at which the downcast ends
 and the upcast begins.

 INPUT:
 
 OUTPUT:
 
 AUTHOR: Derrick Snowden
         NOAA/AOML/PhOD
         Thu Jul 08 14:48:33 EDT 2004
 
 SEE ALSO:
         read_sbecnv.m

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function varargout  = splitcnv(cnv)
0002 % splitcnv: Split a cnv structure into upcast/downcast
0003 %
0004 % DESCRIPTION:
0005 %   Splits the cnv structure returned from read_sbecnv, into two
0006 % structures containing the downcast and upcast respectively.
0007 % The maximum pressure is used as the point at which the downcast ends
0008 % and the upcast begins.
0009 %
0010 % INPUT:
0011 %
0012 % OUTPUT:
0013 %
0014 % AUTHOR: Derrick Snowden
0015 %         NOAA/AOML/PhOD
0016 %         Thu Jul 08 14:48:33 EDT 2004
0017 %
0018 % SEE ALSO:
0019 %         read_sbecnv.m
0020 %
0021 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0022 
0023 % First, figure out where the pressure data is in the cnv data matrix
0024 theNames = cnv.names;
0025 pr_idx = strmatch('pr',theNames);
0026 if isempty(pr_idx)
0027     pr_idx = strmatch('prDM',theNames);
0028 end
0029 if isempty(pr_idx)
0030     throw('Unable to determine the column with pressure.')
0031 end
0032 
0033 % Find max pressure
0034 [max_pressure,max_pressure_idx] = max(cnv.data(:,pr_idx));
0035 
0036 % Copy meta data fields
0037 up = cnv; down = cnv;
0038 
0039 % Replace data field with the correct subset.
0040 up.data = cnv.data(max_pressure_idx+1:end,:);
0041 down.data = cnv.data(1:max_pressure_idx,:);
0042 
0043 if nargout == 0
0044         assignin('caller', 'ans', [down up]);
0045 else
0046     [varargout{:}] = deal(down, up);
0047 end
0048 return
0049

Generated on Fri 08-Oct-2004 11:57:17 by m2html © 2003