% plottrlat_superp.m
% plot transects de haut en bas: amplitude
% X=lon
% cree par JG le 26/09
% xx numero de station depart
% yy numero de station fin
% zz lettre pour indiquer si c'est le a: 1er passage, b 2e etc...
close all
ici=pwd;
cd f:\golts\Survey\Survey081204\ADCPTethys\tronca
xx1=2;
yy1=6;
zz1='a';
eval(['load g1204tr',int2str(xx1),'t',int2str(yy1),zz1,'t.mat;'])
xyt1=xyt;
cd (ici)
[ampl1,angle1]=umod(uv(1:2:end-1,:),uv(2:2:end,:));
clear xyt zc uv
min1=min(xyt1(:,2));
max1=max(xyt1(:,2));

cd f:\golts\Survey\Survey081204\ADCPTethys\tronca
xx2=6;
yy2=2;
zz2='a';
eval(['load g1204tr',int2str(xx2),'t',int2str(yy2),zz2,'t.mat;'])
xyt2=xyt;
cd (ici)
[ampl2,angle2]=umod(uv(1:2:end-1,:),uv(2:2:end,:));
clear xyt zc uv
min2=min(xyt2(:,2));
max2=max(xyt2(:,2));

cd f:\golts\Survey\Survey081204\ADCPTethys\tronca
xx3=1;
yy3=68;
zz3='a';
eval(['load g1204tr',int2str(xx3),'t',int2str(yy3),zz3,'t.mat;'])
xyt3=xyt;
cd (ici)
[ampl3,angle3]=umod(uv(1:2:end-1,:),uv(2:2:end,:));
clear xyt zc uv
min3=min(xyt3(:,2));
max3=max(xyt3(:,2));

cd f:\golts\Survey\Survey081204\ADCPTethys\tronca
xx4=6;
yy4=2;
zz4='b';
eval(['load g1204tr',int2str(xx4),'t',int2str(yy4),zz4,'t.mat;'])
xyt4=xyt;
cd (ici)
[ampl4,angle4]=umod(uv(1:2:end-1,:),uv(2:2:end,:));
clear xyt uv
min4=min(xyt4(:,2));
max4=max(xyt4(:,2));

mint=min([min1,min2,min3,min4]);
maxt=max([max1,max2,max3,max4]);

% AJOUT FOND BATHY
cd f:\GOLTS_JUYA\GRAPHIQUES_MATLAB\RES4_imb1
imax=175;
jmax=145;
load BATHYFILE
load LATITUDE
load LONGITUDE
lat=LATITUDE;
lon=LONGITUDE;
bathy=BATHYFILE;
bottom = bathy(:,2);
Z=reshape(bottom,jmax,imax);
lat=reshape(lat,jmax,imax);
lon=reshape(lon,jmax,imax);

xybati1=xyt1(:,1:2);
Zi1=griddata(lon,lat,Z,xybati1(:,1),xybati1(:,2));
xybati1(end+1,:)=xybati1(end,:);
Zi1(end+1)=100000;

xybati3=xyt3(:,1:2);
Zi3=griddata(lon,lat,Z,xybati3(:,1),xybati3(:,2));
xybati3(end+1,:)=xybati3(end,:);
Zi3(end+1)=100000;

xybati4=xyt4(:,1:2);
Zi4=griddata(lon,lat,Z,xybati4(:,1),xybati4(:,2));
xybati4(end+1,:)=xybati4(end,:);
Zi4(end+1)=100000;

figure

ax1=axes('position',[0.25 0.71 0.45 0.2]);
pcolor(xyt1(:,2),zc,flipud(ampl1))
hold on
contour(xyt1(:,2),zc,flipud(ampl1),[0.2 0.2],'w');
shading interp, caxis([0 0.6]), c1=colorbar;
set(c1,'ytick',[0:0.2:0.6],'yticklabel',[0:0.2:0.6])
set(gca,'xtick',[42.3:0.1:43.2],'XTickLabel',[],'fontsize',12,'layer','top')
title(['',int2str(xx1),' - ',int2str(yy1),' ',zz1,''],'fontsize',12)
ylabel('Profondeur (m)','fontsize',12)
axis([mint maxt -200 0])
%bathymetrie
fill(xybati3(:,2),-Zi3+10,[0.4 0.4 0.4])
hold off

ax2=axes('position',[0.25 0.48 0.45 0.2]);
pcolor(xyt3(:,2),zc,flipud(ampl3))
hold on
contour(xyt3(:,2),zc,flipud(ampl3),[0.2 0.2],'w');
shading interp,caxis([0 0.6]), c3=colorbar;
set(c3,'ytick',[0:0.2:0.6],'yticklabel',[0:0.2:0.6])
set(gca,'xtick',[42.3:0.1:43.2],'XTickLabel',[],'fontsize',12,'layer','top')
title(['',int2str(xx3),' - ',int2str(yy3),' ',zz3,''],'fontsize',12)
ylabel('Profondeur (m)','fontsize',12)
axis([mint maxt -200 0])
%bathymetrie
fill(xybati3(:,2),-Zi3+10,[0.4 0.4 0.4])
hold off

ax3=axes('position',[0.25 0.25 0.45 0.2]);
pcolor(xyt4(:,2),zc,flipud(ampl4))
hold on
contour(xyt4(:,2),zc,flipud(ampl4),[0.2 0.2],'w');
shading interp,caxis([0 0.6]), c4=colorbar;
set(c4,'ytick',[0:0.2:0.6],'yticklabel',[0:0.2:0.6])
title(['',int2str(xx4),' - ',int2str(yy4),' ',zz4,''],'fontsize',12)
ylabel('Profondeur (m)','fontsize',12)
axis([mint maxt -200 0])
set(gca,'xtick',[42.3:0.1:43.2],'xticklabel',[42.3:0.1:43.2],'fontsize',12,'layer','top')
%bathymetrie
fill(xybati3(:,2),-Zi3+10,[0.4 0.4 0.4])
hold off


set(gcf,'unit','centimeter',...
		'papertype','A4',...
		'PaperPosition',[-3.51 3.34 30 23])
 
cd (ici)
%print -dpsc2 -P\\00SAMBACOM\laser4550bc