ms_calc_flux | R Documentation |
Determines solute fluxes from interpolated daily Q (discharge
or precipitation) and corresponding chemistry data.
For cumulative solute loads computed by various methods, see ms_calc_load()
.
ms_calc_flux(chemistry, q)
chemistry |
A |
q |
A |
#' MacroSheds format (only date, site_code, var, and val are required in inputs to this function):
column | definition |
date | Date in YYYY-mm-dd |
site_code | A unique identifier for each MacroSheds site, identical to primary source site code where possible. See ms_load_sites() . |
grab_sample | Boolean integer indicating whether the observation was obtained via grab sample or installed sensor. 1 = TRUE (grab sample), 0 = FALSE (installed sensor). |
var | Variable code. See ms_load_variables() . |
val | Data value. See ms_load_variables() for units. |
ms_status | Boolean integer. 0 = clean value. 1 = questionable value. See "Technical Validation" section of the MacroSheds data paper for details. |
ms_interp | Boolean integer. 0 = measured or imputed by primary source. 1 = interpolated by MacroSheds. See "Temporal Imputation and Aggregation" section of the MacroSheds data paper for details. |
val_err | The combined standard uncertainty associated with the corresponding data point, if estimable. See "Detection Limits and Propagation of Uncertainty" section of the MacroSheds data paper for details. |
This is the format returned by ms_load_product for core time-series data.
Our Solute fluxes are calculated by multiplying solute concentration by daily water volume.
Stream and precipitation flux are computed differently. For stream flux (stream chemistry * discharge),
flux is: kg/ha/d = mg/L \* L/s \* 86400 / 1e6 / ws_area.
Precipitation flux (precip chemistry \* precip depth over the watershed)
is calculated as: kg/ha/d = mg/L \* mm/d / 100.
You can convert between kg/ha/d and kg/d using ms_scale_flux_by_area()
and
ms_undo_scale_flux_by_area()
.
returns a tibble
in MacroSheds format (see details) of stream or
precipitation chemical flux for every dayduring which discharge/precipitation
and chemistry are reported. Output units are kg/ha/d.
Spencer Rhea
Mike Vlah, vlahm13@gmail.com
Wes Slaughter
ms_calc_load()
, ms_scale_flux_by_area()
, ms_undo_scale_flux_by_area()
ms_root = 'data/macrosheds'
ms_download_core_data(macrosheds_root = ms_root,
domains = 'hbef')
chemistry <- ms_load_product(macrosheds_root = ms_root,
prodname = 'stream_chemistry',
site_codes = c('w1', 'w3'),
filter_vars = c('NO3_N', 'Cl'))
q <- ms_load_product(macrosheds_root = ms_root,
prodname = 'discharge',
site_codes = c('w1', 'w3'))
flux <- ms_calc_flux(chemistry = chemistry,
q = q)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.