Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,18 @@ jobs:
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
shell: Rscript {0}

- name: Set up Quarto
uses: quarto-dev/quarto-actions/setup@v2

- name: Render Quarto manual
run: quarto render rfaR-book --to html

- name: Add manual to pkgdown site
run: |
rm -rf docs/book
mkdir -p docs/book
cp -a rfaR-book/_book/. docs/book/

- name: Deploy to GitHub pages 🚀
if: github.event_name != 'pull_request'
uses: JamesIves/github-pages-deploy-action@v4.5.0
Expand Down
5 changes: 4 additions & 1 deletion _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@ home:
href: https://www.rmc.usace.army.mil/Software/RMC-RFA/
navbar:
structure:
left: [intro, reference, articles, news]
left: [intro, manual, reference, articles, news]
components:
manual:
text: User Manual
href: book/
articles:
text: Articles
menu:
Expand Down
48 changes: 22 additions & 26 deletions rfaR-book/01-introduction.qmd
Original file line number Diff line number Diff line change
@@ -1,46 +1,42 @@
# Introduction

`rfaR` is an R implementation of the Risk Management Center's Reservoir Frequency Analysis software (RMC-RFA). This package produces hydrologic hazard curves with uncertainty bounds by combining deterministic flood routing with a nested Monte Carlo framework. Hydrologic hazard analyses support risk assessments in accordance with the USACE Dam & Levee Safety Program (DLS).

## Purpose

`rfaR` is an R implementation of the Risk Management Center Reservoir
Frequency Analysis (RMC-RFA) software. RMC-RFA (and `rfaR`) use apply stratified
monte carlo methods to deterministic flood routing to produce a hydrologic hazard
curve[^1] at individual dam and levee sites. Hazard analyses support risk assessments
within the USACE Dam & Levee Safety Program.
The intended use of `rfaR` is to generate hydrologic hazard curves/loading curves[^1], supporting risk analyses for dams and levees. The development of `rfaR` was primarily to conduct hazard analyses using GEV inflow volume-frequency parameters, developed from partial duration series in arid locations (RMC-RFA only supports LPIII parameters). Additional package development incorporates analysis at levees (no reservoir routing), transforming sampled unregulated inflow values to regulated inflow values, and a stage-based probabilistic bounding of hydrologic hazard curves.

[^1]: In risk analysis, the *hazard* is the risk source where potential consequences relate to harm [@aven_society_nodate]. In the context of dam and levee risk analyses, the source of risk is often defined using a reservoir stage-frequency relationship. The terms *hydrologic loading*, *stage-frequency*, and *hydrologic hazard* are used interchangeably to relate reservoir/river stages to annual exceedance probabilities (AEPs). These relationships are commonly presented as curves and are used as probabilistic loading conditions in dam and levee risk analyses.


## rfaR Analysis Summary

`rfaR` combines deterministic flood routing (Modified Puls) with a
nested, two-loop Monte Carlo framework to quantify:
`rfaR` combines deterministic flood routing (Modified Puls) with a nested, two-loop Monte Carlo framework. The nested framework handles both natural variability and knowledge uncertainty:

- **Natural variability** — simulated in the inner loop as a *realization*. Each
realization represents 10,000 indiviual flood events with randomly sampled
starting stage, hydrograph shape, and inflow volume (from an associated frequency distribution).
- **Natural variability** — simulated in the inner loop as a *realization*. Each realization represents 10,000 indiviual flood events with randomly sampled starting stages, hydrograph shapes, and inflow volumes (from an associated inflow-frequency distribution).

- **Knowledge uncertainty (epistemic uncertainty)** — simulated in the outer loop, by sampling
different parameter sets (from LP3 or GEV flood frequency distributions,
informed by MCMC output from RMC-BestFit).
- **Knowledge uncertainty (epistemic uncertainty)** — simulated in the outer loop, by sampling different inflow-frequency parameter sets (from LP3 or GEV flood frequency distributions, informed by RMC-BestFit's MCMC output).

## Relationship to RMC-RFA
## Scope and Limitations

`rfaR` reimplements the core RMC-RFA methodology in open-source R, offering:
`rfaR` implements the core RMC-RFA methodology into R, a populatr open-source statisical language. `rfaR` is intended to serve as a bridge between the current release of RMC-RFA and the planned second version of RMC-RFA. As of November 2026, users cannot import an existing RMC-RFA model or input file directly into `rfaR`; users must prepare the required inputs separately.

- Reproducibility and transparency in the routing and sampling logic
- Integration with the broader R/RMC ecosystem (e.g., RMC-BestFit outputs)

## How This Manual Is Organized
## User Manual Outline

- **Methodology** — statistical and hydrologic methods behind the two-loop
simulation framework
- **Installation** — getting `rfaR` running locally
- **Workflow** — an end-to-end walkthrough from raw inputs to a
stage-frequency curve
- **Simulation Modes** — Median, Expected, and Full Uncertainty simulation modes explained
- **Function Reference** — Function references (auto-generated from package documentation)
- **Validation** — comparison against RMC-RFA / HEC-HMS benchmark results
- **Installation** — System requirements and instructions for installing and
loading `rfaR`.
- **Set Up an rfaR Analysis** — Prepare a new `rfaR` analysis, including
project organization and input-data preparation.
- **Methodology** — Statistical and hydrologic methods underlying the
two-loop simulation framework.
- **Workflow** — Detailed guidance for using `rfa_simulate()`, defining input
options and simulation settings, and processing outputs.
- **Validation** — Compare `rfaR` results with RMC-RFA and HEC-HMS benchmark
results.
- **Function Reference** — Reference documentation for `rfaR` functions and
their arguments.
- **References**

For function-level documentation, also see the
[pkgdown reference site](https://usace-rmc.github.io/rfaR/).
74 changes: 74 additions & 0 deletions rfaR-book/02-installation.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Installation

`rfaR` is currently not available on the Comprehensive R Archive Network (CRAN). The package source code is available from the [USACE-RMC GitHub repository](https://github.com/USACE-RMC/rfaR).

## System Requirements

- R version 4.1 or later
- Internet access to reach the `USACE-RMC/rfaR` GitHub repository
- Recommended: IDE geared towards science & engineering, such as RStudio [RStudio](https://posit.co/products/open-source/rstudio) or [Positron](https://positron.posit.co/)

## Install rfaR

### Install with remotes (recommended)

Install the `remotes` package and then install `rfaR` from GitHub:

```r
install.packages("remotes")

remotes::install_github(
"USACE-RMC/rfaR",
build_vignettes = FALSE
)
```

### Install with devtools (developers and contributors)

Users who plan to modify the package source should clone the repository and work from a local copy of the project. After cloning the repository with Git or GitHub Desktop, open an R session or RStudio Project from the repository root directory.

Install devtools if it is not already available (requires Rtools):

```r
install.packages("devtools")
devtools::install_github("USACE-RMC/rfaR")
```

During active development, load the package source into the current R session without installing it:

```r
devtools::load_all()
```

To install the local working copy of `rfaR` into your R library, run:

```r
devtools::install()
```

::: {.callout-note}
Cloning the repository does not make `library(rfaR)` available. To use the package, install it with `devtools::install()` or `remotes::install_github()`, or load the source for development with `devtools::load_all()`.
:::

## Dependencies

Required package dependencies are declared in the `rfaR` `DESCRIPTION` file and are installed automatically during installation. Installing `rfaR` with `remotes` or `devtools` installs required R package dependencies as needed.

USACE users may encounter package download, installation, or compatibility issues because of network controls, repository-access restrictions, or locally managed R environments.

To report an installation or version-compatibility issue, open an issue in the [rfaR GitHub repository](https://github.com/USACE-RMC/rfaR/issues). Include the R version, operating system, installation method, and complete error message when possible. Do not include Controlled Unclassified Information (CUI), credentials, access tokens, or other nonpublic system information in a GitHub issue.

## Verify Installation

Load `rfaR` and confirm that the installed version and included example data are available:

```r
# Load package
library(rfaR)
# Check package version
packageVersion("rfaR")
# Print some example data
head(jmd_wy1980_stage)
```

If these commands run without error, rfaR is installed and ready to use.
27 changes: 0 additions & 27 deletions rfaR-book/03-installation.qmd

This file was deleted.

Loading
Loading