% plot_ADCP_traitement.m
ici=pwd;

%cd D:\golts\Survey\golts_1204\
%cd D:\golts\Valor\Valor080303\golts_aphi2\
cd h:\golts\Survey\golts_2002
%cd E:\Gatti2\Theveny\golts_valor_mars
%cd E:\Gatti2\golts\Valor\Valor040904\golts
ses='202';
eval(['load TGS0',ses,'skaphi.mat'])

x=(1:1:nEnsembles)';
zc=(-244:4:-8)'; 

% conversion cm/s en m/s
ve=ve/100;
vn=vn/100;
vz=vz/100;
verr=verr/100;
eastCurrentComponent=eastCurrentComponent/100;
northCurrentComponent=northCurrentComponent/100;
speedCurrentComponent=speedCurrentComponent/100;

figure
ax1=axes('position',[0.25 0.73 0.45 0.2]);
pcolor(x,zc,flipud(ve'))
% cmin=35;
% cmax=100;
caxis([-5 5])
shading interp, c1=colorbar;
%title(['GOLTS Juin 2002 - TGS0',ses,''])
ylabel(['ve (m.s-1)'])
set(gca,'XTickLabel',[])
set(gca,'layer','top')

ax2=axes('position',[0.25 0.51 0.45 0.2]);
pcolor(x,zc,flipud(vn'))
caxis([-5 5])
shading interp, c2=colorbar;
ylabel(['vn (m.s-1)'])
set(gca,'XTickLabel',[])
set(gca,'layer','top')

ax3=axes('position',[0.25 0.29 0.45 0.2]);
pcolor(x,zc,flipud(vz'))
caxis([-0.2 0.2])
shading interp, c2=colorbar;
ylabel(['vz (m.s-1)'])
%set(gca,'XTickLabel',[])
set(gca,'layer','top')

% ax4=axes('position',[0.25 0.07 0.45 0.2]);
% pcolor(x,zc,flipud(verr'))
% caxis([-0.1 0.1])
% shading interp, c2=colorbar;
% ylabel(['verr'])
% set(gca,'layer','top')
xlabel('Temps (nombre de profils)')

nomfigjpg=['vit_avtcorr_',ses,'.jpg'];
nomfig=['vit_avtcorr_',ses,'.fig'];
saveas(gcf,nomfigjpg,'jpg')
saveas(gcf,nomfig,'fig')

figure
ax1=axes('position',[0.25 0.73 0.45 0.2]);
pcolor(x,zc,flipud(eastCurrentComponent'))
% cmin=35;
% cmax=100;
caxis([-0.5 0.5])
shading interp,
title('campagne GOLTS Juin 2002','fontsize',12)
ylabel(['U (m.s-1)'])
set(gca,'XTickLabel',[])
set(gca,'layer','top')

ax2=axes('position',[0.25 0.51 0.45 0.2]);
pcolor(x,zc,flipud(northCurrentComponent'))
caxis([-0.5 0.5])
shading interp,
ylabel(['V (m.s-1)'])
set(gca,'XTickLabel',[])
set(gca,'layer','top')

ax3=axes('position',[0.25 0.29 0.45 0.2]);
[m,n]=size(globalFlag);
c=ones(m,n);
c(globalFlag==0)=0;
%imagesc(c')
pcolor(x,zc,flipud(c')),shading interp
ylabel(['Flag'])
xlabel('Temps (nombre de profils)')
set(gca,'layer','top')

nomfigjpg=['vit_avtcorr_',ses,'2.jpg'];
nomfig=['vit_avtcorr_',ses,'2.fig'];
saveas(gcf,nomfigjpg,'jpg')
saveas(gcf,nomfig,'fig')

eval(['load TGS0',ses,'aphi_new.mat'])

x=(1:1:nEnsembles)';
zc=(-244:4:-8)'; 

% conversion cm/s en m/s
ve=ve/100;
vn=vn/100;
vz=vz/100;
verr=verr/100;
eastCurrentComponent=eastCurrentComponent/100;
northCurrentComponent=northCurrentComponent/100;
speedCurrentComponent=speedCurrentComponent/100;

figure
ax1=axes('position',[0.25 0.73 0.45 0.2]);
pcolor(x,zc,flipud(eastCurrentComponent'))
% cmin=35;
% cmax=100;
caxis([-0.5 0.5])
shading interp, c1=colorbar;
%title(['GOLTS Juin 2002 - TGS0',ses,''])
ylabel(['U (m.s-1)'])
set(gca,'XTickLabel',[])
set(gca,'layer','top')

ax2=axes('position',[0.25 0.51 0.45 0.2]);
pcolor(x,zc,flipud(northCurrentComponent'))
caxis([-0.5 0.5])
shading interp, c2=colorbar;
ylabel(['V (m.s-1)'])
set(gca,'XTickLabel',[])
set(gca,'layer','top')

ax3=axes('position',[0.25 0.29 0.45 0.2]);
%imagesc(globalFlag'), c3=colorbar;
pcolor(x,zc,flipud(globalFlag')),shading interp,c3=colorbar;
ylabel(['Flag'])
xlabel('Temps (nombre de profils)')
set(gca,'layer','top')

nomfigjpg=['vit_avtcorr_',ses,'3.jpg'];
nomfig=['vit_avtcorr_',ses,'3.fig'];
saveas(gcf,nomfigjpg,'jpg')
saveas(gcf,nomfig,'fig')

cd (ici)