function nourishment_cross_shore_test()
% NOURISHMENT_CROSS_SHORE_TEST  One line description goes here
%
% More detailed description of the test goes here.
%
%
%   See also

%% Copyright notice
%   --------------------------------------------------------------------
%   Copyright (C) 2013 Deltares
%       Kees den Heijer
%
%       kees.denheijer@deltares.nl
%
%       P.O. Box 177
%       2600 MH  DELFT
%       The Netherlands
%       Rotterdamseweg 185
%       2629 HD  DELFT
%
%   This library is free software: you can redistribute it and/or
%   modify it under the terms of the GNU Lesser General Public
%   License as published by the Free Software Foundation, either
%   version 2.1 of the License, or (at your option) any later version.
%
%   This library is distributed in the hope that it will be useful,
%   but WITHOUT ANY WARRANTY; without even the implied warranty of
%   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
%   Lesser General Public License for more details.
%
%   You should have received a copy of the GNU Lesser General Public
%   License along with this library. If not, see <http://www.gnu.org/licenses/>.
%   --------------------------------------------------------------------

% This tools is part of <a href="http://OpenEarth.Deltares.nl">OpenEarthTools</a>.
% OpenEarthTools is an online collaboration to share and manage data and
% programming tools in an open source, version controlled environment.
% Sign up to recieve regular updates of this function, and to contribute
% your own tools.

%% Version <http://svnbook.red-bean.com/en/1.5/svn.advanced.props.special.keywords.html>
% Created: 15 May 2013
% Created with Matlab version: 8.1.0.604 (R2013a)

% $Id$
% $Date$
% $Author$
% $Revision$
% $HeadURL$
% $Keywords: $

MTestCategory.WorkInProgress;

%% test with UNIBEST-TC profile (x positive landward)
x = [-5000 -4000 -3500 -3000 -2500 -2000 -1800 -1700 -1600 -1500 -1400 -1300 -1200 -1100 -1000 -900 -800 -790 -780 -770 -760 -750 -740 -730 -720 -710 -700 -690 -680 -670 -660 -650 -640 -630 -620 -610 -600 -590 -580 -570 -560 -550 -540 -530 -520 -510 -500 -490 -480 -470 -460 -450 -440 -430 -420 -410 -400 -390 -380 -370 -360 -350 -340 -330 -320 -310 -300 -290 -280 -270 -260 -250 -240 -230 -220 -210 -200 -190 -180 -170 -160 -150 -140 -130 -120 -110 -100 -90 -80 -70 -60 -50 -40 -30 -20 -10 0]';
z = [-17.8 -17.3 -16.6 -15.5 -13.7 -11.1 -10 -9.5 -9 -8.5 -8 -7.6 -7.2 -6.8 -6.2 -5.7 -5.27 -5.23 -5.2 -5.13 -5.11 -5.03 -5 -4.92 -4.9 -4.81 -4.78 -4.67 -4.62 -4.53 -4.48 -4.36 -4.27 -4.13 -4.02 -3.91 -3.81 -3.73 -3.64 -3.66 -3.64 -3.7 -3.7 -3.82 -3.93 -4.09 -4.23 -4.4 -4.52 -4.6 -4.66 -4.66 -4.66 -4.58 -4.53 -4.41 -4.33 -4.13 -3.99 -3.73 -3.5 -3.22 -2.98 -2.74 -2.57 -2.39 -2.24 -2.27 -2.26 -2.39 -2.48 -2.56 -2.64 -2.58 -2.57 -2.49 -2.47 -2.13 -1.91 -1.58 -1.3 -1.02 -0.8 -0.58 -0.37 -0.17 0.06 0.35 0.53 0.8 1.1 1.42 1.76 2.26 3.43 5.36 8.2]';

volume = 100;

assert(abs(nourishment_cross_shore(x, z, volume)-volume)<1e-4)

%% test with jarkus profile (x positive seaward)
tr = jarkus_transects('year', 2008, 'id', 17000071);
tr = jarkus_interpolatenans(tr);
x = tr.cross_shore(:);
z = squeeze(tr.altitude);
nnid = ~isnan(z);
x = x(nnid);
z = z(nnid);
assert(abs(nourishment_cross_shore(x, z, volume)-volume)<1e-4)