% plottrlong2 .m
% plot transects de haut en bas: UU (haut), VV, amplitude, angle [0,360] (bas) avec echelles independantes
% y = lon
% cree par AP le 10/09/02
% modifie par JG le 16/01/04

% 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=9;
%xx2=1;
yy1=2;
%yy2=1;
zz='a';

ici=pwd;
%    cd f:\golts\Valor\Valor070405\ADCPTethys\transect
%    eval(['load v0405tr',int2str(xx),'t',int2str(yy1),zz,'.mat;'])
cd h:\golts\Survey\Survey081203\ADCPTethys\tronca
eval(['load g1203tr',int2str(xx),'t',int2str(yy1),zz,'t.mat;'])

% AJOUT FOND BATHY
cd h:\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);
xybati=xyt(:,1:2);
Zi=griddata(lon,lat,Z,xybati(:,1),xybati(:,2));
xybati(end+1,:)=xybati(end,:);
Zi(end+1)=100000;

figure
ax1=axes('position',[0.25 0.71 0.45 0.2]);
pcolor(xyt(:,1),zc,flipud(uv(1:2:end-1,:)))
%caxis([-1 2])
shading interp, c1=colorbar;
%set(c1,'ytick',[-1:0.5:2],'yticklabel',[-1 -0.5 0 0.5 1 1.5 2])
set(gca,'XTickLabel',[],'layer','top','fontsize',12)
eval(['title([''GOLTS decembre 2003 - Radiale ',int2str(xx),'-',int2str(yy1),' ',zz,'.''])'])
%text(min(xyt(:,1))+0.01,-200,'U (Est>0)','fontsize',12);
ylabel('Profondeur (m)','fontsize',12);
%bathymetrie
hold on
%[C,h]=contour(xyt(:,1),zc,flipud(uv(1:2:end-1,:)),[0 0],'k');
fill(xybati(:,1),-Zi,[0.4 0.4 0.4])

ax2=axes('position',[0.25 0.5 0.45 0.2]);
pcolor(xyt(:,1),zc,flipud(uv(2:2:end,:)))
shading interp, c2=colorbar;
hold on
%[C,h]=contour(xyt(:,1),zc,flipud(uv(2:2:end,:)),[0 0],'k');
%set(c2,'ytick',[0:0.5:3],'yticklabel',[0 0.5 1 1.5 2 2.5 3])
set(gca,'XTickLabel',[],'layer','top','fontsize',12)
%text(min(xyt(:,1))+0.01,-200,'V (Nord>0)','fontsize',12);
ylabel('Profondeur (m)','fontsize',12);
%bathymetrie
hold on
%[C,h]=contour(xyt(:,1),zc,flipud(uv(2:2:end,:)),[0 0],'k');
fill(xybati(:,1),-Zi,[0.4 0.4 0.4])


cd (ici)
[ampl,angle]=umod(uv(1:2:end-1,:),uv(2:2:end,:));

ax3=axes('position',[0.25 0.29 0.45 0.2]);
pcolor(xyt(:,1),zc,flipud(ampl))
% jet_pal=colormap(jet(64));
% jet_pal(17,:)=[1 1 1];
% colormap(jet_pal)
hold on
[C,h]=contour(xyt(:,1),zc,flipud(ampl),[0.2 0.2],'w');
shading interp, c3=colorbar;
%set(c3,'ytick',[0:0.5:1.5],'yticklabel',[0 0.5 1 1.5])
set(gca,'XTickLabel',[],'layer','top','fontsize',12)
text(min(xyt(:,1))+0.01,-200,'amplitude','fontsize',12);
ylabel('Profondeur (m)','fontsize',12);
%bathymetrie
hold on
%[C,h]=contour(xyt(:,1),zc,flipud(uv(1:2:end-1,:)),[0 0],'k');
fill(xybati(:,1),-Zi,[0.4 0.4 0.4])

hold off

ax4=axes('position',[0.25 0.08 0.45 0.2]);
pcolor(xyt(:,1),zc,flipud(angle))
caxis([0 360])
shading interp, 
c4=colorbar;
set(c4,'ytick',[0:90:360],'yticklabel',[0 90 180 270 360])
xlabel(['Longitude'],'fontsize',12);
ylabel('Profondeur (m)','fontsize',12);
text(min(xyt(:,1))+0.01,-200,'angle','fontsize',12);
set(gca,'layer','top','fontsize',12)
set(gcf,'unit','centimeter',...
		'papertype','A4',...
		'PaperPosition',[-3.51 3.34 30 23])
    %bathymetrie
hold on
%[C,h]=contour(xyt(:,1),zc,flipud(uv(1:2:end-1,:)),[0 0],'k');
fill(xybati(:,1),-Zi,[0.4 0.4 0.4])
 
umin=min(min(uv(1:2:end,:)));  
umax=max(max(uv(1:2:end,:)));
vmin=min(min(uv(2:2:end,:)));
vmax=max(max(uv(2:2:end,:)));
amplimin=min(min(ampl));
amplimax=max(max(ampl));

%print -dpsc2 -P\\00SAMBACOM\laser4550bc