function analyze_this(info, dirs)

% read dimensions
warning off
x = nc_varget('xboutput.nc', 'globalx');
u = nc_varget('xboutput.nc', 'u');
zs = nc_varget('xboutput.nc', 'zs');
time = nc_varget('xboutput.nc', 'globaltime');

% figure 1
f1 = figure;
for i = 1:20:160
    subplot(2,1,1);
    plot(x,squeeze(zs(i,2,:)),'k','LineWidth',1.5); hold on;
    plot(x(1,:),x(1,:)*0+0.01,'r','LineWidth',1.5)
    plot(x(1,:),x(1,:)*0-0.01,'r','LineWidth',1.5)
    title('Water level at t = 0 to 160s with 20s interval');
    xlabel('x [m]');
    ylabel('\eta [m]');
    
    axis([0 1000 -0.04 0.04]);
    set(gca,'FontSize',12);
    
    subplot(2,1,2);
    plot(x,squeeze(u(i,2,:)),'k','LineWidth',1.5); hold on;
    plot(x(1,:),x(1,:)*0+0.014,'r','LineWidth',1.5)
    plot(x(1,:),x(1,:)*0-0.014,'r','LineWidth',1.5)
    title('Water velocity at t = 0 to 160s with 20s interval');
    xlabel('x [m]');
    ylabel('u [m/s]');
    
    axis([0 1000 -0.04 0.04]);
    set(gca,'FontSize',12);
end

xb_write_plot(f1, dirs.output, 'snapshotshort');

% figure 2
f2 = figure;
for i = 500:20:1200
    subplot(2,1,1);
    plot(x,squeeze(zs(i,10,:)),'k','LineWidth',1.5); hold on;
    plot(x(1,:),x(1,:)*0+0.02,'r','LineWidth',1.5)
    plot(x(1,:),x(1,:)*0-0.02,'r','LineWidth',1.5)    
    title('Water level at t = 500 to 1200s with 20s interval');
    xlabel('x [m]');
    ylabel('\eta [m]');
    
    axis([0 1000 -0.04 0.04]);
    set(gca,'FontSize',12);
    
    subplot(2,1,2);
    plot(x,squeeze(u(i,2,:)),'k','LineWidth',1.5); hold on;
    plot(x(1,:),x(1,:)*0+0.0280,'r','LineWidth',1.5)
    plot(x(1,:),x(1,:)*0-0.0280,'r','LineWidth',1.5)  
    title('Water velocity at t = 500 to 1200s with 20s interval');
    xlabel('x [m]');
    ylabel('u [m/s]');
    
    axis([0 1000 -0.04 0.04]);
    set(gca,'FontSize',12);
end

xb_write_plot(f2, dirs.output, 'snapshotlong');

zs1 = squeeze( zs(1:20:160,:,:));
max_zs1 = [max( zs1(:)) 0.01];

u1 = squeeze( u(1:20:160,:,:));
max_u1 = [max( u1(:)) 0.014];

zs2 = squeeze( zs(500:1200,:,:));
max_zs2 = [max( zs2(:)) 0.02];

u2 = squeeze( u(500:1200,:,:));
max_u2 = [max( u2(:)) 0.014*2];

I       = find(diff(sign(squeeze( zs(1000,10,:))))>0 );
X       = x(1,:);
L       = [diff(X(I)) 560];


matrix2latex([max_zs1'  max_zs2' max_u1' max_u2'  L'], 'filename', 'table.tex', ...
    'caption',  sprintf('The XBeach and analytical wave heights and wave lengths. The amplitude without reflection is computed for the period t=0 to t=600s. The amplitude for the standing wave pattern is computed for the period t=500 to t=1200. The amplitude is defined as the maximum water level/velocity in the domain for the given time period.'), ...
	'rowjustification','p{1.5cm}',...    
	'rowlabel', {'XBeach','Analytical solution'}, ...
    'collabel', {'Amplitude [m]','Amplitude (Standing wav) [m]','velocitie amplitude [m/s]','Velocitie amplitude (Standing wave) [m/s]', 'Wave length [m]'}, ...
    'format',	{'%d', '%4.3f', '%4.3f','%4.3f', '%4.3f','%4.3f'});

