
% read WG data from BOG database on solstice

% sqlstr = ['select platform, deployment, date_time, LONGITUDE, LATITUDE, ' ...
%   'CTD_depth, O2_conc, pCO2_water, distance ' ...
%   'from WG_data ' ...
%   'where platform=''wgTiny'' and pCO2_water>0 ' ...
%   'order by deployment, date_time'];
% data = bogquery(sqlstr);

sqlstr = ['select deployment, date_time, LONGITUDE, LATITUDE ' ...
  'from WG_data ' ...
  'where platform=''wgTiny'' ' ...
  'order by deployment, date_time'];
data = bogquery(sqlstr);

u = unique(data.deployment);
dist = [];
for n=1:length(u)
  f = find(data.deployment == u(n));
  [x,y] = lonlat2km( data.LONGITUDE(f(1:end-1)), ...
    data.LATITUDE(f(1:end-1)), data.LONGITUDE(f(2:end)), ...
    data.LATITUDE(f(2:end)) );
  dist = [dist; 0; sqrt( x.^2 + y.^2 )];
end
