% maketr_0604.m
% permet de créer les fichiers *.mat correspondant aux transects
% de la campagne Golts de Jun04 à partir des fichiers tet0604aXX.txt et
% tet0604goltsXX.txt
% from AP le 10/09/02
% modifié par JG
ici=pwd;
zc=(-244:4:-8)'; % d'apres ConfigADCP du fichier .mat

for xx=4:11

cd e:\Gatti2\golts\Survey\Survey070604\ADCPTethys\tronca
eval(['load tet0604a',int2str(xx),'t.txt'])
eval(['xytold=tet0604a',int2str(xx),'t;'])
eval(['load tet0604golts',int2str(xx),'t.txt'])
eval(['uvold=tet0604golts',int2str(xx),'t;'])

if xx==4
   xyt=xytold(:,1:95)';
   uv=uvold(1:95,:)'/100;
   save g0604tr01t7at.mat xyt uv zc
      
   xyt=xytold(:,95:426)';
   uv=uvold(95:426,:)'/100; % pour avoir en m/s
   save g0604tr7t6at.mat xyt uv zc
   
   xyt=xytold(:,427:685)';
   uv=uvold(427:685,:)'/100; % pour avoir en m/s
   save g0604tr6t2at.mat xyt uv zc
   
   xyt=xytold(:,735:842)';
   uv=uvold(735:842,:)'/100; % pour avoir en m/s
   save g0604tr2t0at.mat xyt uv zc
   
   clear xyt uv xytold uvold  
end

if xx==5
   xyt=xytold(:,1:76)';
   uv=uvold(1:76,:)'/100; % pour avoir en m/s
   save g0604tr0t1at.mat xyt uv zc
   
   xyt=xytold(:,1:294)';
   uv=uvold(1:294,:)'/100; % pour avoir en m/s
   uv(59:62,158)=NaN;
   uv(55:58,160)=NaN;
   uv(53:60,162)=NaN;
   uv(51:54,163)=NaN;
   uv(63:66,179)=NaN;
   uv(59:66,187)=NaN;
   uv(61:70,188)=NaN;
   uv(61:62,193)=NaN;
   uv(65:66,197)=NaN;
   uv(65:68,203)=NaN;
   uv(:,226)=NaN;
   uv(69:70,223)=NaN;
   uv(45:56,292)=NaN;
   save g0604tr0t3at.mat xyt uv zc
   
   xyt=xytold(:,76:555)';
   uv=uvold(76:555,:)'/100; % pour avoir en m/s
   uv(:,151)=NaN;
   uv(69:70,148)=NaN;
   uv(59:66,112)=NaN;
   uv(33:36,351)=NaN;
   uv(65:120,241)=NaN;
   uv(63:66,104)=NaN;
   uv(65:66,122)=NaN;
   uv(65:68,128)=NaN;
   uv(7:10,305)=NaN;
   uv(15:18,352)=NaN;
   uv(71:80,479)=NaN;
   uv(59:62,83)=NaN;
   uv(57:58,85)=NaN;
   uv(53:60,87)=NaN;
   uv(51:54,88)=NaN;
   uv(63:70,113)=NaN;
   uv(61:62,118)=NaN;
   save g0604tr1t6at.mat xyt uv zc
   
   xyt=xytold(:,580:1044)';
   uv=uvold(580:1044,:)'/100; % pour avoir en m/s
   uv(:,436)=NaN;
   uv(3:4,292:293)=NaN;
   uv(:,382)=NaN;
   uv(:,451)=NaN;
   uv(71:98,169)=NaN;
   uv(:,315)=NaN;
   uv(95:108,273)=NaN;
   uv(55:58,170)=NaN;
   uv(53:70,201)=NaN;
   uv(41:54,397)=NaN;
   uv(79:84,84)=NaN;
   uv(59:70,327)=NaN;
   uv(65:66,346)=NaN;
   uv(69:70,346)=NaN;
   save g0604tr6t7at.mat xyt uv zc
   
   clear xyt uv xytold uvold
end

if xx==6  
   xyt=xytold(:,1:446)';
   uv=uvold(1:446,:)'/100; % pour avoir en m/s
   save g0604tr7t6bt.mat xyt uv zc
   
   xyt=xytold(:,465:634)';
   uv=uvold(465:634,:)'/100; % pour avoir en m/s
   save g0604tr6t4at.mat xyt uv zc
   
   xyt=xytold(:,634:750)';
   uv=uvold(634:750,:)'/100; % pour avoir en m/s
   
end

if xx==7
   xyt(118:285,:)=xytold(:,1:168)';
   uv(:,118:285)=uvold(1:168,:)'/100;
   uv(35:52,107)=NaN;
   uv(59:96,179)=NaN;
   uv(57:62,201)=NaN;
   uv(15:16,14)=NaN;
   uv(13:14,29)=NaN;
   save g0604tr4t9at.mat xyt uv zc
   
   clear xyt uv
   
   xyt=xytold(:,180:339)';
   uv=uvold(180:339,:)'/100;
   uv(85:96,28)=NaN;
   uv(49:66,159)=NaN;
   uv(7:10,110)=NaN;
   uv(53:54,118:119)=NaN;
   uv(:,158)=NaN;
   uv(43:44,5)=NaN;
   save g0604tr9t2at.mat xyt uv zc

   xyt=xytold(:,348:494)';
   uv=uvold(348:494,:)'/100;
   uv(51:72,146)=NaN;
   uv(87:108,85)=NaN;
   uv(87:114,67)=NaN;
   save g0604tr2t4at.mat xyt uv zc
   
   xyt=xytold(:,512:799)';
   uv=uvold(512:799,:)'/100;
   uv(39:64,49)=NaN;
   uv(41:70,67)=NaN;
   uv(41:64,109)=NaN;
   uv(39:62,206)=NaN;
   uv(47:106,256)=NaN;
   uv(63:104,275)=NaN;
   save g0604tr4t9bt.mat xyt uv zc
   
   xyt=xytold(:,806:836)';
   uv=uvold(806:836,:)'/100;
   save g0604tr9t02at.mat xyt uv zc
   
   clear xyt uv xytold uvold
end

if xx==8
   xyt=xytold(:,1:27)';
   uv=uvold(1:27,:)'/100;
   save g0604tr02t9at.mat xyt uv zc
   
   xyt=xytold(:,28:316)';
   uv=uvold(28:316,:)'/100;
   save g0604tr9t4at.mat xyt uv zc
   
   xyt=xytold(:,334:547)';
   uv=uvold(334:547,:)'/100;
   uv(:,1)=NaN;
   uv(9:12,11)=NaN;
   uv(35:36,28)=NaN;
   uv(49:62,66)=NaN;
   save g0604tr4t1at.mat xyt uv zc
   
   clear xyt uv xytold uvold
end

if xx==9
   xyt=xytold(:,5:413)';
   uv=uvold(5:413,:)'/100;
   uv(67:100,156)=NaN;
   uv(67:68,93)=NaN;
   uv(91:108,242)=NaN;
   uv(75:86,261)=NaN;
   uv(61:96,326)=NaN;
   uv(67:92,409)=NaN;
   save g0604tr1t6bt.mat xyt uv zc
   
   xyt=xytold(:,431:651)';
   uv=uvold(431:651,:)'/100; % pour avoir en m/s   
end

if xx==10
   xyt(222:425,:)=xytold(:,13:216)';
   uv(:,222:425)=uvold(13:216,:)'/100;
   save g0604tr6t7bt.mat xyt uv zc
   
   clear xyt uv
   
   xyt=xytold(:,216:550)';
   uv=uvold(216:550,:)'/100;
   save g0604tr7t6ct.mat xyt uv zc
   
   xyt=xytold(:,550:632)';
   uv=uvold(550:632,:)'/100;
end

if xx==11
   xyt(84:130,:)=xytold(:,1:47)';
   uv(:,84:130)=uvold(1:47,:)'/100;
   save g0604tr6t4bt.mat xyt uv zc
   
   clear xyt uv
    
   xyt=xytold(:,63:355)';
   uv=uvold(63:355,:)'/100;
   uv(21:24,14)=NaN;
   uv(:,106)=NaN;
   uv(65:78,112)=NaN;
   uv(115:116,132)=NaN;
   uv(:,138)=NaN;
   uv(15:20,120:124)=NaN;
   uv(49:76,188)=NaN;
   uv(59:68,189)=NaN;
   uv(57:76,190)=NaN;
   uv(53:60,212)=NaN;
   uv(83:100,260)=NaN;
   uv(65:100,280)=NaN;
   save g0604tr4t9ct.mat xyt uv zc
   
   xyt=xytold(:,364:524)';
   uv=uvold(364:524,:)'/100;
   uv(37:52,108)=NaN;
   uv(55:56,121)=NaN;
   uv(67:68,159)=NaN;
   uv(71:72,160)=NaN;
   save g0604tr9t2bt.mat xyt uv zc
   
   xyt=xytold(:,524:668)';
   uv=uvold(524:668,:)'/100;
   uv(:,11)=NaN;
   uv(43:44,79)=NaN;
   save g0604tr2t9at.mat xyt uv zc
   
   xyt=xytold(:,668:866)';
   uv=uvold(668:866,:)'/100;
   save g0604tr9t4bt.mat xyt uv zc
   
   xyt=xytold(:,889:1019)';
   uv=uvold(889:1019,:)'/100;
   uv(39:72,1)=NaN;
   uv(1:2,26:27)=NaN;
   uv(:,18)=NaN;
   uv(63:66,131)=NaN;
   save g0604tr4t2at.mat xyt uv zc
   
   xyt=xytold(:,1032:1160)';
   uv=uvold(1032:1160,:)'/100;
   uv(79:80,1)=NaN;
   uv(:,11)=NaN;
   save g0604tr2t0bt.mat xyt uv zc
    
   clear xyt uv xytold uvold    
end

end

cd (ici)
