function nc_multibeam_from_asc_shift_odds(raw_path, shifted_path, offset)
warning('to be relocated to OpenEarthTools\matlab\applications\nc_processing\nc_multibeam\')
% NC_MULTIBEAM_FROM_ASC_SHIFT_ODDS
%
% relocate raw asc files that are shifted
% with respect to the assumed grid spacinh
% before proceeding with processing with nc_multibeam_from_asc
%
%See also: nc_multibeam_from_asc_shift_odds

D               = dir2(raw_path,'file_incl','(\.asc$)');
files           = find(~[D.isdir]);
fullfilenames   = strcat({D(files).pathname}, {D(files).name})';

multiWaitbar('Processing asc files',0);

n_shifted = 0;

for ii = 1:length(fullfilenames);
    
    %% 
    
    [path, fname, extension] = fileparts(fullfilenames{ii});
    if ~strcmp(extension,lower(extension))
        movefile(fullfilenames{ii},fullfile(path,[fname lower(extension)]));
        [path, fname, extension] = fileparts(fullfilenames{ii});
    end
    
    %% read header
    
    fid          = fopen(fullfilenames{ii});
    s            = textscan(fid,'%s %f',6);
    ncols        = s{2}(strcmpi(s{1},'ncols'        ));
    nrows        = s{2}(strcmpi(s{1},'nrows'        ));
    xllcorner    = s{2}(strcmpi(s{1},'xllcorner'    ));
    yllcorner    = s{2}(strcmpi(s{1},'yllcorner'    ));
    cellsize     = s{2}(strcmpi(s{1},'cellsize'     ));
    fclose(fid);
    
    %% check location: corners should be located at mesh defined by cellsize
    
    if mod(xllcorner,cellsize) > offset
        disp(fullfilenames{ii});
        disp(mod(xllcorner,cellsize));
        n_shifted = n_shifted +1;
        if n_shifted==1
           mkpath(shifted_path);
        end
        movefile(fullfilenames{ii},fullfile(shifted_path,[fname extension]));
    elseif mod(yllcorner,cellsize) > offset
        disp(fullfilenames{ii});
        disp(mod(yllcorner,cellsize));
        movefile(fullfilenames{ii},fullfile(shifted_path,[fname extension]));
    end
    
    multiWaitbar('Processing asc files',ii/length(fullfilenames))
    
end

disp([mfilename,' shifted ',num2str(n_shifted),' files.'])