function s = readMKL2015(path)
%

% MKL
OPT.ncpath1      = path; % local
OPT.Filename1    = 'Totale kust MKL TKL BKL Trend uit toetsing september 2015.xlsx';

% jarkus database for transect info
OPT.ncpath      = 'http://opendap.deltares.nl/thredds/dodsC/opendap/rijkswaterstaat/jarkus/profiles/';
OPT.Filename   = 'transect.nc';

% general settings
OPT.refdatenum   = datenum(1970,1,1);

%% Read data form jarkus transect.nc
id       = ncread([OPT.ncpath OPT.Filename],'id');
along    = ncread([OPT.ncpath OPT.Filename],'alongshore');
cross    = ncread([OPT.ncpath OPT.Filename],'cross_shore');
areaname = ncread([OPT.ncpath OPT.Filename],'areaname');
x        = ncread([OPT.ncpath OPT.Filename],'x');
y        = ncread([OPT.ncpath OPT.Filename],'y');
timeJ    = ncread([OPT.ncpath OPT.Filename],'time');

year_MKL    = 2015;
time = datenum(num2str(year_MKL),'yyyy') - OPT.refdatenum;

jarkusyear = str2num(datestr(OPT.refdatenum+ncread([OPT.ncpath OPT.Filename],'time'),'yyyy')); %#ok<ST2NM>

% now read the .xls file for 2015
disp(['reading MKL 2015 '])
MKL2015  = xls2struct(fullfile(OPT.ncpath1, OPT.Filename1),'units',0);

% define vars in .xls and remove the nans
xlsdatenum    = cellfun(@(x) datenum(x),MKL2015.Year(2:end)); % 2 is header
NotNans = [false(1,1); ~isnan(xlsdatenum)]; % 2 is header

xlscode = MKL2015.Kv(NotNans);
xlsraai = MKL2015.Nr(NotNans);
xlsMaxS = MKL2015.XMaxSea(NotNans);
xlsMinL = MKL2015.XMinLand(NotNans);
xlsZup  = MKL2015.ZUpperBeachVolume(NotNans);
xlsZlo  = MKL2015.ZLowerBeachVolume(NotNans);
xlsxMKL = MKL2015.XMkl(NotNans);
xlsVol  = MKL2015.Volume(NotNans);
xlsID   = xlscode*1e6 + xlsraai;

datenum_MKL = xlsdatenum(~isnan(xlsdatenum));
date_MKL    = datenum_MKL - OPT.refdatenum;


%% convert Xmkl in RD coordinates and in WGS84 and follow the alongshore def
% MKL2015 in RD coordinates
MKL2015_x    = NaN(length(id),length(jarkusyear)); MKL2015_y   = NaN(length(id),length(jarkusyear));
MKL2015MaxS  = NaN(length(id),length(jarkusyear)); MKL2015date = NaN(length(id),length(jarkusyear));
MKL2015_Zup  = NaN(length(id),length(jarkusyear)); MKL2015_Zlo = NaN(length(id),length(jarkusyear));
MKL2015_Xmkl = NaN(length(id),length(jarkusyear)); MKL2015_Vol = NaN(length(id),length(jarkusyear));
MKL2015MinL  = NaN(length(id),length(jarkusyear));

[ids, xlsids] = ismember(id, xlsID);
[~, idt] = ismember(year_MKL, jarkusyear);
for i = 1:length(id)
    if ids(i)
        
        MKL2015_Xmkl(i,idt) = xlsxMKL(xlsids(i));
        MKL2015MaxS(i,idt)  = xlsMaxS(xlsids(i)); 
        MKL2015MinL(i,idt)  = xlsMinL(xlsids(i)); 
        MKL2015date(i,idt)  = date_MKL(xlsids(i));
        MKL2015_Zup(i,idt)  = xlsZup(xlsids(i)); 
        MKL2015_Zlo(i,idt)  = xlsZlo(xlsids(i));
        MKL2015_Vol(i,idt)  = xlsVol(xlsids(i));
        
        MKL2015_x(i,idt) = interp1(cross', x(:,i), xlsxMKL(xlsids(i)));
        MKL2015_y(i,idt) = interp1(cross', y(:,i), xlsxMKL(xlsids(i)));
    end
end
% MKL in WGS84 coordinates
[MKL2015_lon, MKL2015_lat] = convertCoordinates(MKL2015_x,MKL2015_y,'CS1.code',28992,'CS2.code',4326);

s.id = id;
s.areaname = areaname;
s.time     = timeJ;

s.MKL_lat = MKL2015_lat';
s.MKL_lon = MKL2015_lon';
s.MKL_x   = MKL2015_x';
s.MKL_y   = MKL2015_y';

s.Xmkl    = MKL2015_Xmkl';
s.Volume  = MKL2015_Vol';

s.timeMKL  = MKL2015date';
s.hoog     = MKL2015_Zup';
s.laag     = MKL2015_Zlo';
s.XzeeMKL  = MKL2015MaxS';
s.XMinLand = MKL2015MinL';

