% plot_int_cor.m
ici=pwd;

% trace pour la campagne 2004
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
cd d:\golts\Survey\golts_0604\

ses='406';
eval(['load TGS0',ses,'skaphi.mat'])

x=(1:1:nEnsembles)';
zc=(-244:4:-8)'; 
intmoy=(int1+int2+int3+int4)/4;
cormoy=(cor1+cor2+cor3+cor4)/4;
% avoir les courants en m.s-1
eastCurrentComponent=eastCurrentComponent/100;
northCurrentComponent=northCurrentComponent/100;
speedCurrentComponent=speedCurrentComponent/100;

figure
ax1=axes('position',[0.25 0.71 0.45 0.2]);
pcolor(x,zc,flipud(eastCurrentComponent'))
shading interp, c1=colorbar;
Pc=get(c1,'position');
Pc(3)=0.03;
set(c1,'position',Pc,'fontsize',12)
title(['GOLTS Juin 2004 - TGS0',ses,''],'fontsize',12)
ylabel(['U (m.s-1)'])
set(gca,'XTickLabel',[],'layer','top','fontsize',12)

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

ax3=axes('position',[0.25 0.29 0.45 0.2]);
pcolor(x,zc,flipud(cormoy'))
cmin=min(min(cormoy));
cmax=max(max(cormoy));
caxis([cmin cmax])
shading interp, c2=colorbar;
Pc=get(c2,'position');
Pc(3)=0.03;
set(c2,'position',Pc,'fontsize',12)
hold on
[hco,co]=contour(x,zc,flipud(cormoy'),[64 64],'w');
set(co,'linewidth',1.5)
ylabel(['correlation moyenne'],'fontsize',12)
set(gca,'XTickLabel',[],'layer','top','fontsize',12)

ax4=axes('position',[0.25 0.08 0.45 0.2]);
pcolor(x,zc,flipud(intmoy'))
%  cmin=min(min(intmoy));
%  cmax=max(max(intmoy));
cmin=35;
cmax=100;
caxis([cmin cmax])
shading interp, c1=colorbar;
Pc=get(c1,'position');
Pc(3)=0.03;
set(c1,'position',Pc,'ytick',[30:10:100],'fontsize',12)
%title(['GOLTS Juin 2004 - TGS0',ses,''])
ylabel('intensite moyenne','fontsize',12)
xlabel('temps (nombre de profils)','fontsize',12)
set(gca,'layer','top','fontsize',12)

figure
plot(fliplr(cormoy(377,:)),zc,'k',fliplr(intmoy(377,:)),zc,'--k',fliplr(speedCurrentComponent(377,:))*100,zc,'k')
hold on
plot(fliplr(cormoy(405,:)),zc,'r',fliplr(intmoy(405,:)),zc,'--r',fliplr(speedCurrentComponent(405,3:end))*100,zc(3:end),'r')
hold on
plot([64 64],[zc(1) zc(end)],'k')

% trace pour la campagne 2002
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
cd d:\golts\Survey\golts_2002
ses='212';
eval(['load TGS0',ses,'skaphi.mat'])

x2=(1:1:nEnsembles)';
zc2=(-244:4:-8)'; 
intmoy2=(int1+int2+int3+int4)/4;
cormoy2=(cor1+cor2+cor3+cor4)/4;
eastCurrentComponent2=eastCurrentComponent/100;
northCurrentComponent2=northCurrentComponent/100;
speedCurrentComponent2=speedCurrentComponent/100;

figure
ax1=axes('position',[0.25 0.71 0.45 0.2]);
pcolor(x2,zc2,flipud(eastCurrentComponent2'))
shading interp, c1=colorbar;
Pc=get(c1,'position');
Pc(3)=0.03;
set(c1,'position',Pc,'fontsize',12)
title(['GOLTS Decembre 2002 - TGS0',ses,''],'fontsize',12)
ylabel(['U (m.s-1)'])
set(gca,'XTickLabel',[],'layer','top','fontsize',12)

ax2=axes('position',[0.25 0.5 0.45 0.2]);
pcolor(x2,zc2,flipud(northCurrentComponent2'))
shading interp, c2=colorbar;
Pc=get(c2,'position');
Pc(3)=0.03;
set(c2,'position',Pc,'fontsize',12)
ylabel(['V (m.s-1)'])
set(gca,'XTickLabel',[],'layer','top','fontsize',12)

ax3=axes('position',[0.25 0.29 0.45 0.2]);
pcolor(x2,zc2,flipud(cormoy2'))
cmin=min(min(cormoy2));
cmax=max(max(cormoy2));
caxis([cmin cmax])
shading interp, c2=colorbar;
Pc=get(c2,'position');
Pc(3)=0.03;
set(c2,'position',Pc,'fontsize',12)
ylabel('correlation moyenne','fontsize',12)
hold on
[hco,co]=contour(x2,zc2,flipud(cormoy2'),[64 64],'w');
set(co,'linewidth',1.5)
set(gca,'XTickLabel',[],'layer','top','fontsize',12)

ax4=axes('position',[0.25 0.08 0.45 0.2]);
pcolor(x2,zc2,flipud(intmoy2'))
%  cmin=min(min(intmoy));
%  cmax=max(max(intmoy));
 cmin=35;
 cmax=100;
caxis([cmin cmax])
shading interp, c1=colorbar;
Pc=get(c1,'position');
Pc(3)=0.03;
set(c1,'position',Pc,'ytick',[30:10:100],'fontsize',12)
ylabel(['intensite moyenne'],'fontsize',12)
xlabel('temps (nombre de profils)','fontsize',12)
set(gca,'layer','top','fontsize',12)

figure
subplot(211)
plot(x,intmoy(:,39),'r',x2,intmoy2(:,39),'k')
set(gca,'xlim',[x(1) x(end)],'fontsize',12)
xlabel('temps (nombre de profils)','fontsize',12)
ylabel('intensité moyenne à 160m','fontsize',12)
grid on

cd (ici)