OPT.main.file_incl          = '\w001001.adf$';
OPT.main.dir_incl          = '\d{4}';
OPT.main.dir_depth          = 3;
OPT.main.path_source        = 'e:\checkouts\DienstZeeland\outerdeltas\raw\voordelta\wrong_offset\';%'..\outerdeltas\raw\voordelta\';

fns1 = dir2(OPT.main.path_source,...
    'file_incl', OPT.main.file_incl,...
    'dir_incl', OPT.main.dir_incl,...
    'no_dirs', true,...
    'depth', OPT.main.dir_depth,...
    'case_sensitive', false);

multiWaitbar('Processing adf files',0)

for ii = 1:length(fns1)
    [X,Y,D,M] = arc_info_binary(fns1(ii).pathname,'debug',0,'warning',0);
    fns1(ii).xcellsize = abs(unique(diff(X)));
    fns1(ii).xoffset = unique(mod(X, 20));
    fns1(ii).ycellsize = abs(unique(diff(Y)));
    fns1(ii).yoffset = unique(mod(Y, 20));
%     fprintf('%i\t%i\t%i\t%i\t%s\n', xcellsize, xoffset, ycellsize, yoffset, fns1(ii).pathname);
    multiWaitbar('Processing adf files',ii/length(fns1))
end

cellsizes = [fns1.xcellsize; fns1.ycellsize];
[ucellsizes,~,ic] = unique(cellsizes', 'rows');
for ii = 1:size(ucellsizes,1)
    fprintf('Cellsize = %g %g (%g%%)\n', ucellsizes(ii,:), sum(ic==ii)/numel(ic)*100)
end

offsets = [fns1.xoffset; fns1.yoffset];
[uoffsets,ia,ic] = unique(offsets', 'rows');
for ii = 1:size(uoffsets,1)
    fprintf('Offset = %g %g (%g%%)\n', uoffsets(ii,:), sum(ic==ii)/numel(ic)*100)
    fs = {fns1(ic==ii).pathname};
    fprintf('\t%s\n', fs{:});
end