function OK = grid_orth_getMapInfoFromDataset_test
%grid_orth_getMapInfoFromDataset_test
%
%See also: grid_2D_orthogonal

BB = vaklodingen_definition

%% one with catalog (FAST)

url       = 'http://opendap.deltares.nl/thredds/catalog/opendap/rijkswaterstaat/kustlidar/catalog.xml';
CATALOG   = grid_orth_getMapInfoFromDataset(url)

OK(1)     = strcmpi(strrep(CATALOG.catalognc,'dodsC','catalog'),strrep(url,'.xml','.nc'))
OK(end+1) = strcmpi(CATALOG.dataset  ,url)
OK(end+1) = iscell (CATALOG.x_ranges);
OK(end+1) = iscell (CATALOG.y_ranges);
OK(end+1) = iscell (CATALOG.urls);

% to do: check all individual tile extents

OK(end+1) = all(min(cell2mat([CATALOG.x_ranges(:)])) >= min([BB.x{:}]));% -10000
OK(end+1) = all(max(cell2mat([CATALOG.x_ranges(:)])) <= max([BB.x{:}]));% 300000
OK(end+1) = all(min(cell2mat([CATALOG.y_ranges(:)])) >= min([BB.y{:}]));% 362500
OK(end+1) = all(max(cell2mat([CATALOG.y_ranges(:)])) <= max([BB.y{:}]));% 662500

%% one without catalog (SLOW)

url       = 'http://opendap.deltares.nl/thredds/catalog/opendap/rijkswaterstaat/vaklodingen/catalog.xml';
CATALOG   = grid_orth_getMapInfoFromDataset(url)

%exclude, no catalog OK(1)     = strcmpi(strrep(CATALOG.catalognc,'dodsC','catalog'),strrep(url,'.xml','.nc'))
OK(end+1) = strcmpi(CATALOG.dataset  ,url)
OK(end+1) = iscell (CATALOG.x_ranges);
OK(end+1) = iscell (CATALOG.y_ranges);
OK(end+1) = iscell (CATALOG.urls);

% to do: check all individual tile extents

OK(end+1) = all(min(cell2mat([CATALOG.x_ranges(:)])) >= min([BB.x{:}]));% -10000
OK(end+1) = all(max(cell2mat([CATALOG.x_ranges(:)])) <= max([BB.x{:}]));% 300000
OK(end+1) = all(min(cell2mat([CATALOG.y_ranges(:)])) >= min([BB.y{:}]));% 362500
OK(end+1) = all(max(cell2mat([CATALOG.y_ranges(:)])) <= max([BB.y{:}]));% 662500

%%

OK = all(OK)