Returns a data frame with an alteration status assessment for every flow metric.

assess_alteration(percentiles, predictions, ffc_values, comid, annual)

Arguments

percentiles

dataframe of calculated FFC results percentiles, including the metric column and columns for p10,p25,p50,p75, and p90

predictions

dataframe of predicted flow metrics, as returned from get_predicted_flow_metrics.

ffc_values

dataframe of the raw results from the online FFC, as returned by evaluate_gage_alteration or get_results_as_df

comid

integer comid of the stream segment the previous parameters are for

annual

boolean indicating whether to run a year over year analysis. If TRUE, then the parameter percentiles changes and should be a data frame with only two columns - the first is still metric, but the second is just value representing the current year's value for the metric. predictions should then still have fields for the metric, p25, and p75, where p25 and p75 represent the lower and upper bounds for comparison, regardless of if they're calculated percentiles, or another set of bounds. When run in an annual mode, it assesses alteration similarly to the description above, and with the same result structure, but provides likely_unaltered results when value is within the p25 and p75 values, and provides likely_altered otherwise without additional checks described in the CEFF guidance document, appendix F.

Details

Generates an alteration status assessment for every flow metric based on the rules developed under CEFF for flow alteration. This function pairs well with the boxplots for visualizing alteration, but only this function assesses the data under the rules. Returns a data frame with columns "metric" , "status_code", "status", "alteration_type", "median_in_iqr", and "comid".

The comid will be the same for all rows, and will match what you provide as an input, but allows for merging of these results into larger tables.

status_code will be -1 (likely altered), 0 (indeterminate), 1 (likely unaltered), or NA (insufficient data to determine). status will be a text description of the status code (-1=likely_altered, 0=indeterminate, 1=likely_unaltered, NA=Not_enough_data). alteration_type will tell you the direction of potential alteration for likely altered and indeterminate metrics - the direction of alteration is determined by comparing the median value to the 25th and 7th percentiles of the predicted metrics. It will provide "low" or "high" values for most metrics and "early" or "late" values for timing metrics. For likely_unaltered metrics, it will provide "none_found" and for metrics with insufficient data, it will provide "undeterminable.". Also includes a boolean field median_in_iqr indicating whether the median is in the interquartile range.