filein='pe_trk.nc';

[x,y,z,time,typedr]=hopsgui_extdrifters(filein);

nfloat=input(sprintf('>>>>>Which drift do you want to plot (%2d) to (%2d) or all (0):',1,size(time,2)));
if nfloat==0
	ni=1;
	nf=size(time,2);
else
	ni=nfloat;
	nf=nfloat;
end

lastf=max(findobj('type','figure'));
	figure(1+lastf)
	plot(x,y);grid on
	coastomega
	ti=sprintf('All Drifters ');
	title(ti);xlabel('Latitude');ylabel('Longitude')


for drif=ni:nf
figure(drif+1+lastf)
if strcmp('z',strrep(typedr(drif),' ',''))



	indicenn=find(~isnan(time(:,drif)));
	indicetm=find(time(:,drif)== round(time(:,drif)));

	
	plot(x(:,drif),y(:,drif),'k');grid on
	hold on;plot(x(indicenn(1),drif),y(indicenn(1),drif),'ko')
	hold on;plot(x(size(time,1),drif),y(size(time,1),drif),'ks');hold off
	hold on;plot(x(indicetm,drif),y(indicetm,drif),'bs');hold off
	coastomega
	ti=sprintf('Surface Drifter number %3d at %6.2f metres', drif,z(indicenn(1),drif));
	title(ti)
	xlabel('Latitude')
	ylabel('Longitude')

else
	indicenn=find(~isnan(time(:,drif)));
	subplot(2,2,1)
	plot(time(:,drif),z(:,drif),'-o');grid on
	ti=sprintf('Density Drifter number %3d initialy at %6.2f metres', drif,z(indicenn(1),drif));
	title(ti);xlabel('Time');ylabel('Depth');
	
	subplot(2,2,2)
	plot3(x(:,drif),y(:,drif),-z(:,drif));grid on
	hold on;plot3(x(2,drif),y(2,drif),-z(2,drif),'ko')
	hold on;plot3(x(size(time,1),drif),y(size(time,1),drif),-z(size(time,1),drif),'ks');hold off
	ti=sprintf('Density Drifter number %3d initialy at %6.2f metres', drif,z(indicenn(1),drif));
	title(ti);xlabel('Latitude');ylabel('Longitude');ztitle('Depth');

	subplot(2,2,3)
	plot(x(:,drif),y(:,drif),'k');grid on
	hold on;plot(x(2,drif),y(2,drif),'ko')
	hold on;plot(x(size(time,1),drif),y(size(time,1),drif),'ks');hold off
	coastomega
	ti=sprintf('Density Drifter number %3d initialy at %6.2f metres', drif,z(indicenn(1),drif));
	title(ti);xlabel('Latitude');ylabel('Longitude')
	
end
end


clear  drif  indicenn  nf nfloat ni  ti typedr
