function [skewness] = skewness_extract(hydrograph,baseflow,...
    fraction_ignore)
% Function takes input of hydrograph, baseflow, and the fraction to ignore
% and calculates the skewness of the hydrograph

% Remove flows at baseflow + ignore_fraction

flows_above = hydrograph(hydrograph(:,1)>(baseflow+150*fraction_ignore),:);

[~,max_index] = max(flows_above(:,1));
[flows_end_index,~] = size(flows_above);

dQpos = 0;
for a = 2:max_index
    
    dQpos = dQpos + (flows_above(a,1) - flows_above(a-1,1));
    
end

dQneg = 0;
for b = max_index+1:flows_end_index
    
    dQneg = dQneg + (flows_above(b-1,1) - flows_above(b,1));
    
end

n_pos = max_index - 1;
n_neg = flows_end_index - max_index;

skewness = 1 - (dQneg / n_neg) / (dQpos / n_pos);

end

