corehydro

corehydro is an (unofficial) C++ port of tools developed by the United States Army Corps of Engineers (USACE) Risk Management Center (RMC) and Hydrologic Engineering Center (HEC) for stochastic and computational hydrology including distribution fitting and sampling, timeseries modeling, uncertainty quantification, optimization, machine learning, flood and precip frequency estimation, and a whole lot more.

The motivation behind this porting effort is to increase awareness and accessibility of these amazing software packages which have been released under open-source licenses. Currently this project has ported pieces of the following libraries/packages: - RMC-BestFit (statistical engine fully ported) - Numerics (probability, sampling, and estimation layers) - HEC-FDA (planned, not started)

See the porting status page for the details of what is currently implemented in the core library and in the packages.

What’s inside

  • All 42 univariate distributions of the Numerics library, with moments, density/quantile functions, seeded random generation, and MOM / MLE / L-moment fitting.
  • Bayesian estimation with eight MCMC samplers (RWMH, ARWMH, DEMCz, DEMCzs, HMC, NUTS, Gibbs, SNIS) plus Gelman-Rubin and effective-sample-size diagnostics.
  • The full RMC-BestFit analysis layer: Bayesian frequency analysis, Bulletin 17C, distribution ranking, mixtures, competing risks, point processes, time series, spatial GEV, copulas, rating curves, and predictive checks.
  • Multivariate distributions, copulas, bootstrap uncertainty, and the supporting statistics toolbox (Grubbs-Beck outlier tests, Box-Cox and Yeo-Johnson transforms, plotting positions, Latin hypercube sampling).

Install

Both packages are pre-release and install directly from GitHub. They compile the shared core from source, so a C++17 compiler is required (Xcode command-line tools on macOS, gcc/clang on Linux, Rtools on Windows for R).

pip install "git+https://github.com/cameronbracken/corehydro.git#subdirectory=corehydropy"
import corehydropy as ch

d = ch.Distribution("GeneralizedExtremeValue", [10849, 5745, 0.005])
d.quantile(0.99)
# install.packages("pak")
pak::pak("cameronbracken/corehydro/corehydror")
library(corehydror)

d <- distribution("GeneralizedExtremeValue", c(10849, 5745, 0.005))
dist_quantile(d, 0.99)

Releases on PyPI and CRAN are planned; these instructions will switch to plain pip install / install.packages() when they land.

Learn more