function abs_U = refabs(rel_ref_U, time, lonlat)
%
% derives the ship velocity (from the fixes)
% and the absolute reference layer velocity

nprfs = length(time);

%--- derive ship velocity by differencing the fixes ---
dlonlat = diff(lonlat')';

%--- convert differences to meters ---
alat = lonlat(2,(1:nprfs-1)) + dlonlat(2,:) / 2;
dx = lon_to_m(dlonlat(1,:), alat);
dy = lat_to_m(dlonlat(2,:), alat);

dt = diff(time) * 86400;   % seconds per day 

ship_U = [[NaN;NaN]  [dx ./ dt; dy ./ dt]];           

%--- derive absolute reference layer velocity ---
abs_U = rel_ref_U + ship_U;     

