clear all ; close all ; clc

% . . Elliptic test plotting...
A = load_history('CCcut0.H');
B = load_data(A);
C = B.data;
C = C/abs(max(C(:)));

zaxis = ([0:B.n(1)]*B.d(1)+B.o(1))/1000.;
xaxis = ([0:B.n(2)]*B.d(2)+B.o(2))/1000.;

[u]= find(zaxis < 6);
ztodo = find(zaxis(u) > 2);

acut=15;
pclip=97.5;
figure(1)
axes('position',[0.075 0.065 0.5 0.4])
pcut = prctile(C(:),pclip);
PP = [-pcut pcut];
colormap('gray')

imagesc(xaxis,zaxis(ztodo),C(ztodo,:),PP)
set(gca,'YTickLabel',{'2'; '3'; '4'; '5';'6'},'YTick',[2 3 4 5 6])
%l1=text(18,1.75,'e)');
%set(l1,'FontSize',12)

t1=ylabel('Depth (km)');
t2=xlabel('Distance (km)');
set(t1,'FontSize',12)
set(t2,'FontSize',12)

c1=25;
c2=25;
c3=33;

t1=line([c1 c1],[0 12]);
set(t1,'LineWidth',2)
t1=line([ c2 c2],[0 12]);
set(t1,'LineWidth',2);
t1=line([c3 c3],[0 12]);
set(t1,'LineWidth',2);

% . . PANEL f)
%axes('position',[0.635 0.065 0.08 0.4])
CC1 = load_data(load_history('CCcut1.H'));
aaxis = [0:CC1.n(2)]*CC1.d(2)+CC1.o(2);
%pcut = prctile(CC1.data(:),pclip);
%PP = [-pcut pcut];
%imagesc(aaxis,zaxis(ztodo),CC1.data(ztodo,:) ,PP)
%t1=ylabel('Depth (km)');
%t2=xlabel('Angle (\circ)');
%set(t1,'FontSize',10);
%set(t2,'FontSize',10);
%set(gca,'XTickLabel',{'-45'; '0'; '45'},'XTick',[-45 0 45])
%set(gca,'YTickLabel',{'2'; '3'; '4'; '5';'6'},'YTick',[2 3 4 5 6])
%l1=text(-110,1.75,'f)');
%set(l1,'FontSize',12)

% . . PANEL g)
axes('position',[0.635 0.065 0.08 0.4])
CC2 = load_data(load_history('CCcut2.H'));
pcut = prctile(CC2.data(:),pclip);
PP = [-pcut pcut];
imagesc(aaxis,zaxis(ztodo),CC2.data(ztodo,:),PP)
t1=ylabel('Depth (km)');
t2=xlabel('Angle (\circ)');
set(t1,'FontSize',10);
set(t2,'FontSize',10);
set(gca,'XTickLabel',{'-45'; '0'; '45'},'XTick',[-45 0 45])
set(gca,'YTickLabel',{'2'; '3'; '4'; '5';'6'},'YTick',[2 3 4 5 6])
%l1=text(-110,1.75,'g)');
%set(l1,'FontSize',12)

% . . PANEL h)
axes('position',[0.7775 0.065 0.08 0.4])
CC3 = load_data(load_history('CCcut3.H'));
pcut = prctile(CC3.data(:),pclip);
PP = [-pcut pcut];
imagesc(aaxis,zaxis(ztodo),CC3.data(ztodo,:),PP)
t1=ylabel('Depth (km)');
t2=xlabel('Angle (\circ)');
set(gca,'XTickLabel',{'-45'; '0'; '45'},'XTick',[-45 0 45])
set(gca,'YTickLabel',{'2'; '3'; '4'; '5';'6'},'YTick',[2 3 4 5 6])
set(t1,'FontSize',10);
set(t2,'FontSize',10);
%l1=text(-110,1.75,'h)');
%set(l1,'FontSize',12)


%brighten(0.5)
print -depsc2 GOODbot.eps
disp(['Finished writing image file'])

