function DepSummary = GetGliderDepSummary(s, mission, DepLog)
% grabs the deployment summary from the log. Need to handle cases when
% there are multiple idxs for the same mission.
% Ben Werb 6/4/24

% if isfield(s, 'sdn_start')
%     sdn_startValue = s.sdn_start;
%     idx = ismember(DepLog.("Deployment ID"), mission) &...
%     DepLog.("Date Deployed").Day == datetime(datevec(sdn_startValue)).Day;
% else
%     idx = ismember(DepLog.("Deployment ID"), mission) &...
%     DepLog.("Date Deployed").Day == datetime(datevec(s.sdn(1))).Day;
% end
% if ~all(idx)
%     idx = ismember(DepLog.("Deployment ID"), mission);
% end
% DepSummary = repmat(string(DepLog.("Deployment summary")(idx,:)),length(s.sdn),1);
% 

 % if there are multiple matching depIDs only use the last one.
idx = find(DepLog.("Deployment ID") == mission,1,'last');
DepSummary = repmat(string(DepLog.("Deployment summary")(idx,:)),length(s.sdn),1);

end

