function [xs_return, min_t_r, max_t_r, t_steps] = ...
    xs_data_calc(xs_xy, xs_flow, xs_max_Q, chan_dist_max,  min_t, ...
    max_t, max_Q_fi)
% Function takes information extracted from *.his functions and calculates
% information of interest about cross-sections

max_xs_num = chan_dist_max/250; % Extracts data from 27 km downstream
xs_time = xs_flow(:,1); % set time array
[min_t_r,~] = find(xs_time(:,1)==min_t); % index of set minimum time
[max_t_r,~] = find(xs_time(:,1)==max_t); % index of set maximum time
[t_steps,~] = size(xs_time); % total time steps in model run
xs_xy_27km = xs_xy(2:(max_xs_num+1),:); % Coordinates of XS
xs_flow_27km = xs_flow(:, 2:(max_xs_num+1)); % flow data for upper 27 km
xs_max_Q_27km = xs_max_Q(1:max_xs_num,:); % Extracts maximum Q
xs_dist = xs_max_Q_27km(:,1) * 250; % sets XS distances
xs_rarq = xs_max_Q_27km(:,3)/max_Q_fi; % calculates attenuation 

xs_return = cell(1,5);
xs_return(:,1) = {xs_xy_27km};
xs_return(:,2) = {xs_flow_27km};
xs_return(:,3) = {xs_max_Q_27km};
xs_return(:,4) = {xs_dist};
xs_return(:,5) = {xs_rarq};

end