function f = roms_get_floats(file)
% flt = roms_get_floats(file)
%
% Read data from a ROMS floats file into a structure
%
% John Wilkin

varlist = {'ocean_time','lon','lat','depth','rho','temp','salt'};

for v = varlist
  vname = char(v);
  try
    spv = nc_attget(file,vname,'missing_value');
  catch
    spv = 1e35;
  end
  d = nc_varget(file,vname);
  
  % first entry in always zero - this is a ROMS bug needs fixing
  % d(1,:) = [];
  % floats that exit the domain get zero, not missing value - this needs
  % fixing
  if ~strcmp(vname,'ocean_time')
    if exist('allzeros')~=1
      allzeros = zeros(size(d));
    end
    allzeros = allzeros + (d==0);
  end
    
  % missing_value and _FillValue needs sorting out in ROMS code too
  d(find(d>=spv)) = NaN;
  
  f.(vname) = d;
  
end

outofdomain = find(allzeros~=0);

for v = varlist(2:end)
  vname = char(v);
  f.(vname)(outofdomain) = NaN;
end

f.dnum = nc_timeget(file);
f.dnum(1) = [];
