% Calculates skewness for upstream and 18-km cross-sections after
% his_extract_chap1 has been run

%%%%%%%%%%%%%%
%                sum(delta_Qneg_i / delta_t) / n
% skewness = 1 - -------------------------------
%                sum(delta_Qpos_i / delta_t) / n
%%%%%%%%%%%%%%
% removes lowest X% of flows

fraction_ignore = 0.01;

%% Call function to extract skewness of upstream hydrographs

up_flow_seconds = fld1942daily(:,1)*60;
interp_secs = 0:600:(10080*60);
upstream_Q = interp1(up_flow_seconds,fld1942daily(:,2),interp_secs)';
upstream_base = 314;
upstream_skew = skewness_extract(upstream_Q,...
    upstream_base, fraction_ignore);

%% Call function to extract skewness of downstream hydrographs

hist_skew = skewness_extract(hist_18kmQ,...
    upstream_base, fraction_ignore);
c2010_skew = skewness_extract(c2010_18kmQ,...
    upstream_base, fraction_ignore);
p2010_skew = skewness_extract(p2010_18kmQ,...
    upstream_base, fraction_ignore);
l2010_skew = skewness_extract(l2010_18kmQ,...
    upstream_base, fraction_ignore);

%% Call function to determine change in skewness from upstream

hist_delta_skew = hist_skew - upstream_skew;
c2010_delta_skew = c2010_skew - upstream_skew;
p2010_delta_skew = p2010_skew - upstream_skew;
l2010_delta_skew = l2010_skew - upstream_skew;

