load swfl_coast.mat;
coast=[lon lat];


cd ../../OUTTESTWETflt
fn='calus2008_flt.nc'

%open float file, get coordinates of trajectories
% nc=netcdf(fn);
% x=nc{'x'}(2:end,:);  %last index for for the number of floats released
% y=nc{'y'}(2:end,:);
% close(nc);

x_=nc_varget(fn,'lon');
x=x_(2:end,:);

y_=nc_varget(fn,'lat');
y=y_(2:end,:);

z_=nc_varget(fn,'depth');
z=z_(2:end,:);

dstart=nc_varget(fn,'dstart');
ocean_time=nc_varget(fn,'ocean_time');

cd ../wet/analout


%check initial depths,  many NaNs at beginning, values start at t=25

figure;

for t=1:length(ocean_time),
plot(z(t,:),'r.')
title(['Depths at time ' num2str(t)])
pause
end



%plot initial positions
figure;
plot(lon, lat)
dasp(26)
pause %for zoom
hold on

plot(x(25,1:697),y(25,1:697),'r.')
title('Initial Float Positions, 1st 25 steps NaN, 1st 100 locs=0')





figure;


plot(lon, lat)
dasp(26)
pause %for zoom
hold on

for t=25:length(ocean_time)-1,
plot(x(t,655:697),y(t,655:697),'r.')%,x(t,50),y(t,50),'b.')
pause(0.1)
end
