# Magnitude

## Definition

This metric is the magnitude of the exceedance flow threshold for the 10-, 5-, or 2-year recurrence intervals of annual peak flow. This metric is in units of cfs.

## Steps

1. Convert raw data from a single column of dates and a single column of flows into a matrix with columns organized by water year. Each column starts with the beginning of the water year (i.e. 10/1) and ends with the end of water year (9/30).
2. Calculate the 10%, 20%, and 50% exeedance values of annual peak flow over the entire period of record.

   ```python
   for column_number, _ in enumerate(matrix[0]):
        flow_data = matrix[:, column_number]
        peak_flows.append(np.nanmax(flow_data))
    for percentile in peak_percentiles:
        peak_exceedance_values.append(np.nanpercentile(peak_flows, 100 - percentile))
   ```
3. Set the exceedance flow value as the final value for the magnitude metric.

   ```python
   for percent in exceedance_percent:
            magnitude[percent].append(exceedance_value[percent])
   ```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://eflow.gitbook.io/ffc-readme/functional-flow-calculator/metrics/peak-magnitude-flows/magnitude.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
