ms_calc_vwc | R Documentation |
Calculates stream discharge and precipitation fluxes of chemicals from Q (discharge or precipitation) and chemistry data.
ms_calc_vwc(chemistry, q, q_type, agg = "yearly", verbose = TRUE)
chemistry |
|
q |
|
q_type |
character. Either 'precipitation' or 'discharge'. |
verbose |
logical. Default TRUE; prints more information to console. |
Chemical Volume Weighted Concentration (VWC) is 'traditionally' calculated as VWC = sum(concentrations * volumes) / sum(volumes) over a given period. Because we have discharge (a rate), rather than volume, we could scale it to the sample interval and then use the equation above. For simplicity, we use this instead, which works out the same: VWC = mean(concentrations * discharges) / mean(discharges) Note also that we're starting from flux here, for computational efficiency, so the "concentrations * volumes" part is already computed, and it's a rate too. That means the modified equation is: VWC = mean(fluxes) / mean(discharges). There are two minor introductions of error. The first is that we don't omit discharge values from the denominator that lack a corresponding flux value (this is expensive, and not doing it should rarely skew the results). The second is that a "month" is considered 30 days here, which only affects filtering by coverage.
returns a tibble
of stream or precipitation chemical flux for every timestep
where discharge/precipitation and chemistry are reported. Output units are kg/ha/timestep.
Spencer Rhea
Mike Vlah, vlahm13@gmail.com
Wes Slaughter
ms_calc_flux, ms_synchronize_timestep()
, ms_conversions()
, ms_scale_flux_by_area()
, ms_undo_scale_flux_by_area()
#' ### Load some MacroSheds data:
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', 'w6'),
filter_vars = c('NO3_N', 'Cl', 'Na'))
q <- ms_load_product(macrosheds_root = ms_root,
prodname = 'discharge',
site_codes = c('w1', 'w3', 'w6'))
flux <- ms_calc_vwc(chemistry = chemistry,
q = q,
q_type = 'discharge')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.