% TS_U.m
% pg tracant les profils de T et S pour 3 stations CTD 
% ainsi que la composante U (ouest-est) de l'ADCP de coque.

clear
ici=pwd;
%chargement des profils CTD
path_mat='e:\Gatti2\golts\Survey\Survey081203\CTD\Data_extraites\asc';
[f_mat,p_mat]=uigetfile([path_mat,'\*.asc']);
path_mat_file=[p_mat,f_mat];
fichier=path_mat_file(findstr('stat',path_mat_file):findstr('_dc',path_mat_file)-1);
ctd=load(path_mat_file);

indf1=find(ctd(:,13)==0);

path_mat2='e:\Gatti2\golts\Survey\Survey081203\CTD\Data_extraites\asc';
[f_mat2,p_mat2]=uigetfile([path_mat2,'\*.asc']);
path_mat_file2=[p_mat2,f_mat2];
fichier2=path_mat_file2(findstr('stat',path_mat_file2):findstr('_dc',path_mat_file2)-1);
ctd2=load(path_mat_file2);

indf2=find(ctd2(:,13)==0);

path_mat3='e:\Gatti2\golts\Survey\Survey081203\CTD\Data_extraites\asc';
[f_mat3,p_mat3]=uigetfile([path_mat3,'\*.asc']);
path_mat_file3=[p_mat3,f_mat3];
fichier3=path_mat_file3(findstr('stat',path_mat_file3):findstr('_dc',path_mat_file3)-1);
ctd3=load(path_mat_file3);

indf3=find(ctd3(:,13)==0);

figure

subplot(131)
plot(ctd(indf1,2),-ctd(indf1,6),'b',ctd2(indf2,2),-ctd2(indf2,6),'r',ctd3(indf3,2),-ctd3(indf3,6),'g')
grid on;
xlabel(' Temperature ','Fontsize',12);
ylabel('Depth [m]','Fontsize',12)
legend(fichier,fichier2,fichier3,2)
axis([13 16 -200 0])

subplot(132)
plot(ctd(indf1,7),-ctd(indf1,6),'b',ctd2(indf2,7),-ctd2(indf2,6),'r',ctd3(indf3,7),-ctd3(indf3,6),'g')
grid on;
xlabel(' Salinity ','Fontsize',12)
set(gca,'YTickLabel',[])
axis([37 39 -200 0])
title('GOLTS - 10 Décembre 2003','fontsize',14)
%ylabel('profondeur (m)','fontweight','bold','fontsize',14)

subplot(133)
% xx numero de station depart
% yy numero de station fin
% zz lettre pour indiquer si c'est le a: 1er passage, b 2e etc...
xx=1;
yy=5;
zz='a';

cd e:\Gatti2\golts\Survey\Survey081203\ADCPTethys\tronca
eval(['load g1203tr',int2str(xx),'t',int2str(yy),zz,'t.mat;'])

u1=uv(1:2:end-1,1);
u2=uv(1:2:end-1,84);
u3=uv(1:2:end-1,149);
plot(flipud(u1),zc,'g',flipud(u2),zc,'r',flipud(u3),zc,'b')
xlabel('U [m.s^{-1}] (East>0)','Fontsize',12)
set(gca,'YTickLabel',[])
axis([-1 1 -200 0])
set(gca,'YGrid','on')
cd (ici)