function [ DUDt, fU] = lefthandside(timer, lat, u, v)
%
%   The function [DUDt,fU]=lefthandside(timer, lat, u, v)
%   takes as input data from a recently read rfc float file (or their 
%   lowpassed equivalents) and returns (in complex form, where real is
%   the E-W component and imaginary the N-S component) the two terms
%   of the left hand side of the momentum equation, i.e. the TOTAL 
%   derivative, DUDt, and the Coriolis acceleration, fU.
%
%   --------------------------------------------------------------------
%   Written by Vassilis Zervakis, while at
%              AINCO-Interocean, Madrid, Spain, in January 1996.
%   --------------------------------------------------------------------
%
% ---- convert time in hours ---------------
timer = timer * 24.;
% ---- Calculate total time derivative term -----
DuDt = diff(u) ./ diff(timer);
DvDt = diff(v) ./ diff(timer);
DUDt = DuDt + DvDt * i;
% ---- Calculate Coriolis terms -----------------
for k = 1 : length(u) - 1,
  f = Coriolis((lat(k)+lat(k+1))/2);
% -----convert coriolis from cph to rad per h ----
  f = f * 2 * pi;
  uav = (u(k) + u(k+1))/2;
  vav = (v(k) + v(k+1))/2;   
  fU(k)  = - f*vav + f*uav * i;
end
fU = fU';
