function D=getDONARdata_hcwd(Locations,Parameters)

    url_ini1    = 'd:\repositories\DATA\0_wavesandwind\data\';                                                            % add your local directory here if you need to speed things up
    url_ini2     = 'http://opendap.deltares.nl/thredds/dodsC/opendap/rijkswaterstaat/waterbase/';

    % check if files are available locally
    local = 0;
    if exist([url_ini1 '/id22-' Locations{1}],'file');
        local = 1;
        dir1 = '';
        url_ini = url_ini1;
    end

    %% get data from DONAR database
    for i=1:length(Locations)
        meta        = nc_info([url_ini dir1 '/id22-' Locations{1}]);
        t_end       = meta.Attribute(find(strcmp({meta.Attribute.Name},'time_coverage_end'))).Value;

        D(i).loc = Locations(i);
        for j=1:length(Parameters)
            if local==0; dir1 = Parameters{j}; end

            url     = [url_ini dir1 '/id2' num2str(j+1) '-' Locations{i}]; % nc_dump(url)
            if     j==1; D(i).hm0.val   = nc_varget(url,Parameters{1});  D(i).hm0.time = nc_cf_time(url,'time')';  
            elseif j==2; D(i).th0.val   = nc_varget(url,Parameters{2});  D(i).th0.time = nc_cf_time(url,'time')'; 
            elseif j==3; D(i).tm02.val  = nc_varget(url,Parameters{3});  D(i).tm02.time = nc_cf_time(url,'time')'; 
            end
            clear url;
        end
    end
end