% plottrlat.m
% plot transects de haut en bas: UU (haut), VV, amplitude, angle [0,360] (bas) avec echelles independantes
% y = lat
% 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=6;
yy=1;
zz='a';

ici=pwd;
%  cd h:\golts\Survey\Survey081204\ADCPTethys\tronca
% %cd e:\Gatti2\golts\Survey\Survey_0602_anne
%  eval(['load g1204tr',int2str(xx),'t',int2str(yy),zz,'t.mat;'])
%eval(['load g0603tr',xx,'t',yy,zz,'t.mat;'])
cd h:\golts\Valor\Valor291002\ADCPTethys\transect
eval(['load v1002tr',int2str(xx),'t',int2str(yy),zz,'.mat;'])

%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,:)));
[ind1,ind2]=find(uv(2:2:end,:)==vmax);

% 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);
% cd E:\Gatti2\cluster\matlab
% load bathy200m.sourcecut
% lon=bathy200m2(:,2);
% lat=bathy200m2(:,1);
% Z=bathy200m2(:,3);
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(:,2),zc,flipud(uv(1:2:end-1,:)))
% %caxis([umin umax])
% 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',[])
% set(gca,'Layer','top')
% eval(['title([''GOLTS décembre 2004 - Radiale ',int2str(xx),'-',int2str(yy),zz,'.''])'])
% %eval(['title([''Valor-GOLTS Mars 2003 - Transect ',int2str(xx),' to ',int2str(yy),' ',zz,'.''])'])
% text(min(xyt(:,2))+0.01,-210,'U (Est>0)');
% %bathymetrie
% hold on
% %[C,h]=contour(xyt(:,2),zc,flipud(uv(1:2:end-1,:)),[0 0],'k');
% fill(xybati(:,2),-Zi,[0.4 0.4 0.4])
% ylabel('Profondeur (m)','fontsize',12)
% 
% ax2=axes('position',[0.25 0.5 0.45 0.2]);
% pcolor(xyt(:,2),zc,flipud(uv(2:2:end,:)))
% %caxis([vmin vmax])
% shading interp, c2=colorbar;
% %set(c2,'ytick',[0:0.5:3],'yticklabel',[0 0.5 1 1.5 2 2.5 3])
% %set(gca,'XTickLabel',[])
% set(gca,'Layer','top')
% text(min(xyt(:,2))+0.01,-210,'V (Nord>0)');
% %bathymetrie
% hold on
% %[C,h]=contour(xyt(:,2),zc,flipud(uv(2:2:end,:)),[0 0],'k');
% fill(xybati(:,2),-Zi,[0.4 0.4 0.4])
% ylabel('Profondeur (m)','fontsize',12)
 cd (ici);

[ampl,angle]=umod(uv(1:2:end-1,:),uv(2:2:end,:));
amplimin=min(min(ampl));
amplimax=max(max(ampl));

ax3=axes('position',[0.25 0.29 0.45 0.2]);
pcolor(xyt(:,2),zc,flipud(ampl))
hold on
%[C,h]=contour(xyt(:,2),zc,flipud(ampl),[0.05 0.05],'w');
%caxis([amplimin amplimax])
shading interp, c3=colorbar;
%set(c3,'ytick',[0:0.5:3],'yticklabel',[0 0.5 1 1.5 2 2.5 3])
%set(gca,'XTickLabel',[])
set(gca,'Layer','top','fontsize',12)
%text(min(xyt(:,2))+0.01,-210,'amplitude');
%bathymetrie
hold on
fill(xybati(:,2),-Zi,[0.4 0.4 0.4])
ylabel('Profondeur (m)','fontsize',12)
eval(['title([''GOLTS octobre 2002 - Radiale ',int2str(xx),'-',int2str(yy),zz,'.''])'])

ax4=axes('position',[0.25 0.08 0.45 0.2]);
pcolor(xyt(:,2),zc,flipud(angle))
caxis([0 360])
shading interp, c4=colorbar;
set(c4,'ytick',[0:90:360],'yticklabel',[0 90 180 270 360])
set(gca,'Layer','top')
xlabel(['Latitude']);
%text(min(xyt(:,2))+0.01,-210,'angle');
%bathymetrie
hold on
fill(xybati(:,2),-Zi,[0.4 0.4 0.4])
ylabel('Profondeur (m)','fontsize',12)

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

cd(ici);