
function [time,X,Y,U,windfile] = fn_read_windfile(day,REstar,Bo,nloc,ny)
    

    switch day
      case 18,
        dirstart = 'RE';
      case 9,
        dirstart = 'shoal_RE';
      case 31,
        dirstart = 'shoal_RE';
      otherwise,
        time=nan; X=nan; Y=nan; U=nan;
        disp('*** bad parameters to fn_read_windfile **');
        return
    end;

prefix=sprintf('/home/kghanson/basilisk/shoaling/runs/test_2022_11_%02d/%s%d_BO%d',day,dirstart,REstar,Bo);

windfile=sprintf('%s/shoal_horiz_profs',prefix);
W1 = load(windfile);

[nc,nr] = size(W1);
nt = nc/(ny*nloc);
               
X = W1([1:ny:nloc*ny-1],2)
Y = W1(1:ny,3);
time = W1(1:ny*nloc:end,1);
U = reshape(W1(:,4),ny,nloc,nt);
U = permute(U,[3 1 2]);
