function DATA=data_set_range(DATA,SRC,REC)

if ~isfield(DATA,'scales2'), DATA.scales2=DATA.scales; DATA.labels2=DATA.labels; end
	
dx=SRC.txyvp(:,2) - REC.txyvp(:,2); dy=SRC.txyvp(:,3) - REC.txyvp(:,3);
rng=sqrt(dx.^2 + dy.^2);

% Find DATA dimension containing hour of day:
%
% 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.
jdim_hod=0;
for jdim=1:DATA.ndim
    if ~isempty(findstr(DATA.labels{jdim},'our of day')),
        jdim_hod=jdim; break;
    end
end
if jdim_hod==0, error('Could not find Time - Hour of day in DATA.scales{:}'); return; end
%
data_jday=str2num(DATA.labels{jdim_hod}(end-2:end)),
jday_diff=data_jday - SRC.NAV.jday;
if abs(jday_diff)>1, 
    data_jday, SRC.NAV.jday,
    error('Julian days found to differ by more than one day: '); 
end
t_hod=jday_diff*24 + SRC.txyvp(:,1)/60;
range_sr=mylinear(t_hod,rng,DATA.scales{jdim_hod},0);
DATA.scales2{jdim_hod}=range_sr; DATA.labels2{jdim_hod}='Range - km';
DATA.src_nav=SRC.nav_root; DATA.rec_nav=REC.nav_root;
