% 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_profile_file(day,REstar,Bo)

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);
wind_file = sprintf('%s/shoal_horiz_profs.dat',prefix);
W = load( wind_file);

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

