Streambank erosion model in Matlab

Paper currently under review.

Clone the repo (in terminal)

```
cd my/fav/directory
git clone https://github.com/mitchellmcm27/streambank-model.git
```

Start up Matlab, navigate to the newly created `streambank-model`

folder in your Matlab file tree
load “model_data.mat” into matlab, which contains the input data table:

```
load('model_data')
```

Run the model on a single site:

```
train_model_monthly(model_data(44,:), 'animate')
```

- The required argument is a table containing necessary data and measurements
- 44 is a row (streambank site) used for an example; you can pass the whole table or only some rows
`animate`

(optional) tells the function to plot animations of simulations and enables`plt`

`plt`

(optional) plot only major results (no animations)- Animations are saved in the
`gifs`

folder

Run the model on all sites:

```
output = train_model_monthly(model_data)
```

An example of the model output is saved in the `output`

folder. The model outputs a struct that contains 3 objects:

`output.tbl`

: data table with rows for each modeled site and columns for input data, erosion rates, and modeled rates`output.mdl1`

: statistical model object, using K1 erodibility (see paper)`output.mdl2`

: statistical model object, using K2 erodibility (see paper)

After fitting a model, you can estimate erosion rates at any location using the following function. You can write a custom function or other scheme to use the fitted equation in any way you wish. This function is provided as an example of the model application and uses the same datasets that were used in model training and estimates erosion rates throughout an entire river reach.

```
eval_model_monthly(model_data, 44)
```

- The arguments are input data table and row number
- Note: The model coefficients/exponents fitted in
`train_model_monthly`

are hard-coded into the function logic

This function is similar to `train_model_monthly`

except that, rather than fitting a model to observed erosion rates, a fitted model is applied to the input data. The function thus requires all of the same data used in model fitting, except for observed erosion rates. The function applies the model on an entire NHD Flowline (vector polyline) matching the COMID of the given row. The function samples a raster dataset representing tree cover at many locations along the reach (see `data`

folder). You must supply the path to the raster data in the function `sample_fc_at_points`

(in the `gis`

folder). Three geotiffs are provided in the `forest`

folder, sufficient to run the model with the given data (obtained from the UMD Global Land Cover Facility).

Many of the other Matlab functions/scripts in the repo are outdated or are used by the functions I mentioned here. Be careful deleting functions (sorry).

The `literature`

folder contains the manuscript based on this model (currently under review). The folder also contains a bibliographic database (.bib file), which contains references for all of the literature cited in the paper. You can browse the .bib file in JabRef or import it into Mendeley or Zotero. The .bib file is a BiBTeX database generated by Mendeley Desktop and cleaned up in JabRef.

The other folders contain supporting functions. Some are required for the model calculations, others are only for plotting, colorbars, etc.