Library
Types
Sad.Dingman — TypeDingman river channel cross section.
Uses generalized expressions for cross-section geometry based on at-a-station hydraulic geometry relations.
Wb: bankfull widthYb: bankfull depthYm: flow depthr: geometry exponentS0: bed slopen: Manning roughness coefficient
See also: Rectangular
Sad.Rectangular — TypeRectangular river channel cross section.
Wb: bankfull widthYb: bankfull depthYm: flow depthS0: bed slopen: Manning roughness coefficient
See also: Dingman
Functions
Cross sections
Sad.width — Functionwidth(xs)Calculate water surface width of cross section.
Arguments
xs: cross section
Sad.depth — Functiondepth(xs)Calculate average depth of cross section.
Arguments
xs: cross section
Priors
Sad.get_samples — Functionget_samples(p, samples)Get quantiles from p according to weights provided by Latin Hypercube Sampling samples.
Sad.lhs_ensemble — Functionlhs_ensemble(nens, args...)Generate an ensemble of size nens using Latin Hypercube Sampling of the list of distributions or collections provided as args.
Sad.prior_ensemble — Functionprior_ensemble(x, Qp, np, rp, zp, nens)Generate a prior ensemble of discharge, roughness coefficient, channel shape parameter, and downstream bed elevation from provided distributions or sample data.
Arguments
x: distances between cross sectionsQp: discharge prior distributionnp: roughness coefficient distributionrp: channel shape parameter distributionzp: downstream bathymetry distributionnens: ensemble size
Sad.gvf_ensemble! — Functiongvf_ensemble!(H, S, x, hbf, wbf, Qe, ne, re, ze)Generate an ensemble of water height profiles from Gradually-Varied-Flow simulations and associated profiles of bed elevation.
Arguments
H: water surface elevationS: bed slopex: channel chainagehbf: bankfull water surface elevationwbf: bankfull widthQe: ensemble dischargene: ensemble roughness coefficientre: ensemble channel shape parameterze: ensemble bed elevation profiles
Sad.rejection_sampling — Functionrejection_sampling(Qp, np, rp, zp, x, H, S0, hbc, wbf, hbf, nens, nsamples)Use rejection sampling to select a subset of the prior ensemble.
Arguments
Qp: prior discharge distributionnp: prior roughness coefficient distributionrp: prior channel shape parameter distributionzp: prior distribution for downstream bed elevationx: channel chainageH: time series of observed water surface elevation profilesS0: prior estimate of channel bed slopehbc: mean downstream flow depth used as boundary conditionwbf: bankfull widthhbf: bankfull water surface elevationnens: ensemble sizensamples: number of samples
Sad.priors — Functionpriors(ncfile, hmin, id)Derive prior distributions for discharge, roughness coefficient, channel shape parameter, and bed elevation by reading the SWORD a-priori database.
Arguments
ncfile: NetCDF file of SWORD databasehmin: minimum observed downstream water surface elevationid: Reach ID in SWORD database
priors(qwbm, hmin)Derive distributions for discharge, roughness coefficient, channel shape parameter, and bed elevation using uninformative priors.
Arguments
qwbm: mean dischargehmin: minimum downstream water surface elevation
Kalman filters
Sad.letkf — Functionletkf(A, d, HA, E, xs, ys, ρ, diagR)Apply the Local Ensemble Transform Kalman Filter algorithm.
Arguments
A: state variable ensemble matrixd: observation vectorHA: model-predicted observation ensemble matrixE: observation error ensemble matrixxs: indices of state vector that map to observation local patchesys: indices of observation local patchesρ: covariance inflation parameter (optional, default value of 1.05)diagR: force observation error covariance to be diagonal, i.e. no spatial correlation (optional, default is false)
Gradually Varied Flow
Sad.froude — Functionfroude(Q::Float64, xs::CrossSection)Calculate the Froude number.
Arguments
Q: dischargexs: cross section
Sad.interpolate_hbc — Functioninterpolate_hbc(x, H, S)Interpolate water surface elevation boundary condition by assuming uniform flow, i.e., energy slope is equal to bed slope.
Arguments
x: channel chainageH: water surface elevation profileS: bed slope
Sad.dydx — Functiondydx(y, p, x)Ordinary differential equation describing the Gradually-Varied-Flow model.
Sad.gvf — FunctionCalculate a water surface profile by solving the Gradually-Varied-Flow equation.
Q: dischargeybc: downstream boundary condition for depthS0: bed slope for reachn: roughness coefficientx: downstream distance for each cross sectionwbf: bankfull width for each cross sectionybf: bankfull depth for each cross sectionr: channel geometry coefficient for each cross section
Sad
Sad.drop_unobserved — Functiondrop_unobserved(x, H, W, S)Remove cross sections with no valid observations.
Arguments
x: channel chainageH: time series of water surface elevation profilesW: time series of width profilesS: time series of water surface slope profiles
Sad.assimilate — Functionassimilate(H, W, S, x, wbf, hbf, S0, Qp, np, rp, zp, nens, constrain)Assimilate SWOT observations for river reach.
Arguments
H: time series of water surface elevation profilesW: time series of water surface width profilesS: time series of water surface slope profilesx: downstream distance for each cross sectionwbf: bankfull widthhbf: bankfull depthQₚ: prior probability distribution for dischargenₚ: prior probability distribution for roughness coefficientrₚ: prior probability distribution for channel shape parameterzₚ: prior distribution for downstream bed elevationnens: ensemble sizeconstrain: switch for applying AHG constraint
Sad.bathymetry! — Functionbathymetry!(ze, S, S0, Qe, ne, re, x, hbf, wbf, H, ϵₒ)Estimate channel bed slope and thalweg (elevation) by assimilating SWOT water surface elevation observations.
Arguments
ze: ensemble of bed elevationsS: time series of water surface slope profilesS0: bed slopeQe: ensemble of dischargene: ensemble of roughness coefficientre: ensemble of channel shape parametersx: channel chainagehbf: bankfull water surface elevationwbf: bankfull widthH: time-averaged water surface elevation observedϵₒ: observation error (default value of 10 cm)
Sad.ahg_constrain! — Functionahg_constrain!(Qa, hbc, hbf, wbf, S0, x, ne, re, ze, tol=1e-3)Constrain assimilated discharge with At-a-Station hydraulic geometry (AHG) relationships.
Arguments
Qa: assimilated ensemble dischargehbc: downstream boundary water surface elevationhbf: bankfull water surface elevationwbf: bankfull widthS0: bed slopex: channel chainagene: ensemble roughness coefficientre: ensemble channel shape parameterze: ensemble bed elevationtol: numeric tolerance for closing the AHG relationships
Sad.calc_bed_slope — Functioncalc_bed_slope(x, S)Estimate initial channel bed slope.
Arguments
x: channel chainageS: time series of water surface slope profiles
Sad.calc_dA — Functioncalc_dA(Qa, na, W, S)Calculate changes in cross-sectional area.
Arguments
Qa: time series of estimated dischargena: time series of estimated roughness coefficientW: time series of width profilesS: time series of water surface slope profiles
Sad.flow_parameters — Functionflow_parameters(Qa, na, W, S, dA)Estimate flow parameters (roughness coefficient and baseflow cross-sectional area) from assimilated discharge.
Arguments
Qa: time series of estimated dischargena: time series of estimate roughness coefficientW: time series of observed width (reach)S: time series of observed slope (reach)dA: time series of changes in reach-averaged cross-sectional area (from minimum observed)
Sad.estimate — Functionestimate(x, H, W, S, Qp, np, rp, zp, nens)Estimate discharge and flow parameters from SWOT observations.
Arguments
x: channel chainageH: time series of water surface elevation profilesW:time series of width profilesS: time series of water surface slope profilesQp: discharge prior distributionnp: roughness coefficient prior distributionrp: channel shape parameter prior distributionzp: downstream bed elevation prior distributionnens: ensemble sizensamples: sample size for rejection sampling