function TLz=TL_zavg(TL)
%
hw=interp1(TL.hw_vs_rng(:,1),TL.hw_vs_rng(:,2),TL.ranges);
TLz.y=mean(TL.zr);
TLz.x=TL.ranges;
TLz.z=0;
TLz.data=-300*ones(1,TL.nrange);
TLz.ylab='Avg. Depth - m';
TLz.xlab='Range - km';
TLz.zlab='Bearing';
TLz.dlab='Depth-Avg TL - dB';
for jr=1:TL.nrange,
	ii=find(TL.zr<=hw(jr));
	TLz.data(jr)=10*log10(mean(10.^(TL.tl_coh(jr,ii)/10)));
end
cmin=floor(min(TLz.data(:))/5)*5;
cmax=floor(max(TLz.data(:))/5)*5;
TLz.clim=[cmin,cmax];

	
%
% COPYRIGHT (c) 2008
% 
% Applied Research Laboratories, The University of Texas at Austin
% (ARL:UT)
% All rights reserved.
% 
% This material may be reproduced by or for the U.S. Government
% only. This notice must appear in all copies of this file and its
% derivatives. Further distribution outside the U.S. Government is
% prohibited without the explicit written authorization from the
% Director of the Environmental Sciences Laboratory, ARL:UT.
% 
% THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
% EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO THE
% IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
% PURPOSE, OR NONINFRINGEMENT.
% 
% IN NO EVENT WILL ARL:UT BE LIABLE FOR ANY DAMAGES WHATSOEVER ARISING
% OUT OF THE USE OR INABILITY TO USE THIS SOFTWARE, EVEN IF ARL:UT HAS
% BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
