function [ws,wd] = find_pw_amb_sel(amb_sel,winds,windd,width_ct,length_at)

if nargin < 4
  width_ct = size(winds,2);
  length_at = size(winds,3);
end

max_num_amb = size(winds,1);

amb_sel(amb_sel==0) = 1;
ws = zeros(width_ct,length_at);
wd = zeros(width_ct,length_at);
for g = 1:max_num_amb
  ind = find(amb_sel==g);
  ws(ind) = winds(g,ind);
  wd(ind) = windd(g,ind);
end
