function [ output_args ] = plotongraph_twin(nboffloater, jtlagt, totaltime)
%%%%%%%%%% 



close all

figure(1)

fid = fopen('../obs_float/obs_float_test.dat', 'rb');
fseek(fid, 0, 'eof');
fileSize = ftell(fid);
frewind(fid);
data = fread(fid, fileSize, 'uint8');
numLines = sum(data == 10) + 1;
fclose(fid);
m=numLines-1;
n=m/nboffloater;
m
n

load ../obs_float/obs_float_test.dat;
counterobs=0;
for g=1:nboffloater
    
x=obs_float_test (counterobs+1:2:counterobs+n,4);
y=obs_float_test (counterobs+2:2:counterobs+n,4);
plot(x(1),y(1),'+')
hold on;
plot(x(n/2),y(n/2),'>')
hold on;
plot(x(1:n/2),y(1:n/2),'+');
hold on;
plot(x(1:n/2),y(1:n/2),'-r')
hold on;
counterobs=counterobs+n;
end


fid = fopen('../obs_float/rfloat_total.dat', 'rb');
fseek(fid, 0, 'eof');
fileSize = ftell(fid);
frewind(fid);
data = fread(fid, fileSize, 'uint8');
numLines = sum(data == 10) + 1;
fclose(fid);
p=numLines-1;
u=p/nboffloater;
p 
u
countercorr=0;


load ../obs_float/rfloat_total.dat
ligneobs=0;
for d=1:nboffloater
x2=rfloat_total(countercorr+1:countercorr+u,4);
y2=rfloat_total(countercorr+1:countercorr+u,3);
ligne=ligneobs+1;
for h=1:jtlagt:u
    x2(h)=obs_float_test(ligne,4);
    y2(h)=obs_float_test(ligne+1,4);
    ligne=ligne+2*jtlagt;
end
[k,h]=size(x2);
plot(x2(1),y2(1),'+')
hold on;
plot(x2(k),y2(k),'>')
hold on;
plot(x2(1:k),y2(1:k),'+')
hold on;
plot(x2(1:k),y2(1:k),'-g')
hold on;
ligneobs=ligneobs+n;
countercorr=countercorr+u;
end



load ../obs_float/uv_total.dat;
whos;
X1=uv_total(1:5046,end-3);
Y1=uv_total(1:5046,end-2);
X1=X1+1;
Y1=Y1+1;
%%%%%%change si pas de temps change
U1=zeros(5046,1);
V1=zeros(5046,1);
e=1;
for r=1:1:1
    
    Unew=zeros(1,5046);
    Vnew=zeros(1,5046);
    for count=1:5046
        Unew(count)=uv_total(e,end-1);
        Vnew(count)=uv_total(e,end);
        e=e+1;
    end
    U1=U1+Unew';
    V1=V1+Vnew';
   
    
end

% U1=U1./totaltime;
% V1=V1./totaltime;
%%% Because if the jtlag is 3 we have a set of zeros each 3 time steps in
%%% the uv_total.
U1=U1;
V1=V1;
% U1=roundn(U1,-6);
% V1=roundn(V1,-6);

quiver(X1,Y1,U1,V1,2,'r','Autoscale','off');


load ../obs_float/unext3d.dat;

unext3d=roundn(unext3d,-6)
whos;
X3=unext3d(:,end-2);
Y3=unext3d(:,end-1);
U3=unext3d(:,end);
load ../obs_float/vnext3d.dat
vnext3d=roundn(vnext3d,-6)
V3=vnext3d(:,end);
quiver(X3,Y3,U3,V3,2,'g','Autoscale','off');


load ../obs_float/uzero.dat;

uzero=roundn(uzero,-6)
whos;
X3=uzero(:,end-2);
Y3=uzero(:,end-1);
U3=uzero(:,end);
load ../obs_float/vzero.dat
vzero=roundn(vzero,-6)
V3=vzero(:,end);
quiver(X3,Y3,U3,V3,2,'b','Autoscale','off');



% load ../obs_float/vel_bck_all.dat;
% X2=vel_bck_all(1:5046,end-3);
% Y2=vel_bck_all(1:5046,end-2);
% X2=X2+1;
% Y2=Y2+1;
% %change si pas de temps change
% U2=zeros(5046,1);
% V2=zeros(5046,1);
% ebcknew=1;
% for r=1:1:totaltime-1
%     
%     Ubcknew=zeros(1,5046);
%     Vnew=zeros(1,5046);
%     for count=1:5046
%         Ubcknew(count)=vel_bck_all(ebcknew,end-1);
%         Vbcknew(count)=vel_bck_all(ebcknew,end);
%         ebcknew=ebcknew+1;
%     end
%     U2=U2+Ubcknew';
%     V2=V2+Vbcknew';
%    
%     
% end
% 
% U2=U2./totaltime;
% V2=V2./totaltime;
% 
% quiver(X2,Y2,U2,V2,2,'b','Autoscale','off');


end

