water_type: Calculate water type

View source: R/utils.R

water_typeR Documentation

Calculate water type

Description

Water type based on anions Cl, SO4, HCO3 and cations Ca, Mg, Na and K. Ions are ranked by proportion MEQ, all greater than 10% are listed in descending order of presence, cations first. Water type is only calculated for samples with valid charge balances. If HCO3 is missing, we use Meas Alk as a replacement (indicated by an '*' on HCO3 in the water type). Otherwise, missing ions are ignored (i.e. treated as 0). The column missing_ion indicates whether there is a problem with the water type, such that it is missing a cation or anion (i.e. is all cations or all anions). Water type is designed to compliment piper plots by using the same ions so they are comparable.

Usage

water_type(d)

Arguments

d

Data frame. Must contain columns Sample_Date, SampleID, StationID, Cl_meq, SO4_meq, HCO3_meq, Meas_Alk_meq, Ca_meq, Mg_meq, Na_meq, K_meq and charge_balance.

Value

Data frame with added columns water_type and missing_ion.

Examples


d <- data.frame(Sample_Date = "2022-01-01", SampleID = "999990-01", StationID = 000,
                Cl_meq = 0.0226, SO4_meq = 0.0208, HCO3_meq = 1.54, Meas_Alk_meq = 1.7,
                Ca_meq = 0.187, Mg_meq = 0.490, Na_meq = 0.465, K_meq = 0.0665,
                charge_balance = 0.5)
water_type(d)

# If missing HCO3_meq, use Meas_Alk_meq
d <- data.frame(Sample_Date = "2022-01-01", SampleID = "999990-01", StationID = 000,
                Cl_meq = 0.0226, SO4_meq = 0.0208, HCO3_meq = NA, Meas_Alk_meq = 1.7,
                Ca_meq = 0.187, Mg_meq = 0.490, Na_meq = 0.465, K_meq = 0.0665,
                charge_balance = 0.5)

water_type(d)



steffilazerte/rems2aquachem documentation built on Feb. 17, 2025, 12:01 p.m.