%% 2D Dam Break Dry Bed Model Analyser
% Tim Leijnse
% Made for 2D Dam break dry bed test as performed by Stelling and Duinmeijer (2003)

function analyze_this_2Ddrybed( info, dirs)

ncFileName_sb   = fullfile(dirs.output,'2D_dry_bed_surfbeat','xboutput.nc');
ncFileName_nonh = fullfile(dirs.output,'2D_dry_bed_nonh','xboutput.nc');

d           = xb_read_dims(ncFileName_sb);
dx          = nc_attget(ncFileName_sb, '_parameters', 'dx');
dy          = nc_attget(ncFileName_sb, '_parameters', 'dy');
mmax        = d.nx;
nmax        = d.ny;
t_end       = nc_attget(ncFileName_sb, '_parameters', 'tstop');
dtout       = nc_attget(ncFileName_sb, '_parameters', 'tintg');
timesteps   = t_end/dtout + 1;
           
% Retrieve water levels
%XBSB
xbsbzs = nc_varget(ncFileName_sb, 'zs');
zs_sb = squeeze(xbsbzs(:,:,:));
zs_sb(isnan(zs_sb))=0;

xbsbzst = nc_varget(ncFileName_sb, 'point_zs');
zst_sb = squeeze(xbsbzst(:,:,:));

%XBNH
xbnhzs = nc_varget(ncFileName_nonh, 'zs');
zs_nh = squeeze(xbnhzs(:,:,:));
zs_nh(isnan(zs_nh))=0;

xbnhzst = nc_varget(ncFileName_nonh, 'point_zs');
zst_nh = squeeze(xbnhzst(:,:,:));
       
% Make plots and put them in the folder of 
plot_2Ddrybed(dirs.output, dirs.data, dx, dy, nmax, zs_sb, zst_sb, zs_nh, zst_nh, dtout, timesteps)
