% function W = read_wind_file(day,REstar,Bo)
%
%  reads in the raw surface extract file for a particular simulation and time

function [X,Y,time,U] = read_wind_along_file(day,REstar,Bo)

X = []; Y=[]; time=[]; U=[];

if day==18,  %day = 9;   
    dirstart = 'RE';   %
elseif day==9 || day==31,
    dirstart = 'shoal_RE';
else
    disp('*** Bad day to read_wind_file() ***')
    X=[]; Y=[]; time = [];  U=[];
    return
end;

prefix=sprintf('/home/kghanson/basilisk/shoaling/runs/test_2022_11_%02d/%s%d_BO%d',day,dirstart,REstar,Bo);
along_file = sprintf('%s/shoal_wind_along_profiles.dat',prefix);
if exist(along_file),
    W = load( along_file);
else
    disp(sprintf('Error loading along wind file: %s',along_file))
    return
end;
    

[nc,nr] = size(W);
ny=8;
nx = 59;
nt = nc/(ny*nx);

X = W(1:nx,2);
Y = W([1:nx:nx*ny-1],3);
time = W(1:ny*nx:end,1);
U = reshape(W(:,4),nx,ny,nt);


