function [lon,lat,depth,jd]=roms_flt(ncfile,timesub,driftsub); % ROMS_FLT reads the float files % Usage: [lon,lat,depth,jd]=roms_flt(ncfile,timesub,driftsub); % use timesub ,driftsub to subsample % Example: [lon,lat,depth,jd]=roms_flt('adria02_flt.nc',6,4); % takes every 6th time step and every 4th float if (nargin==1), itimesub=1; idriftsub=1; end spval=0.9e+16; nc=netcdf(ncfile); tim=nc{'ocean_time'}(1:timesub:end); tim=tim./86400; jd=tim+2440000; lon=nc{'lon'}(1:timesub:end,1:driftsub:end); lat=nc{'lat'}(1:timesub:end,1:driftsub:end); if(isempty(lon)), lon=nc{'x'}(1:timesub:end,1:driftsub:end); lat=nc{'y'}(1:timesub:end,1:driftsub:end); end depth=nc{'depth'}(1:timesub:end,1:driftsub:end); ind=find(lon+lat+depth > spval); if (~isempty(ind)), lon(ind)=NaN; lat(ind)=NaN; depth(ind)=NaN; end close(nc);