Title: | Irrigation Water Quality Assessment and Visualizations |
---|---|
Description: | Calculates irrigation water quality ratios and has functions that could be used to plot several popular diagrams for irrigation water quality classification. |
Authors: | Wajid Ali [aut, cre, cph] |
Maintainer: | Wajid Ali <[email protected]> |
License: | GPL (>= 3) |
Version: | 1.8.4 |
Built: | 2024-12-01 08:01:54 UTC |
Source: | CRAN |
This function calculates the percentage of sodium (Na
calculate_Napercent(df, convert_units = FALSE)
calculate_Napercent(df, convert_units = FALSE)
df |
A dataframe containing the necessary columns. |
convert_units |
Logical indicating whether to convert values from mg/l to meq/l. |
A numeric vector containing Na percent values.
df <- data.frame(Ca = c(10, 20, 30), Mg = c(5, 10, 15), Na = c(15, 25, 35), K = c(3, 5, 6)) calculate_Napercent(df, convert_units = TRUE)
df <- data.frame(Ca = c(10, 20, 30), Mg = c(5, 10, 15), Na = c(15, 25, 35), K = c(3, 5, 6)) calculate_Napercent(df, convert_units = TRUE)
This function calculates the PI for water quality.
calculate_PI(df, convert_units = FALSE)
calculate_PI(df, convert_units = FALSE)
df |
dataframe containing the necessary columns, |
convert_units |
Logical, indicating whether to convert units from mg/l to meq/l. |
A numeric vector representing the permeability index (PI) for each row in the dataframe, @examples df <- data.frame(Ca = c(10, 20, 30), Mg = c(5, 10, 15), Na = c(8, 16, 24), Na = c(15, 25, 10), K = c(2, 6, 4), HCO3 = c(15, 30, 45), SO4 = c(110, 115, 88), CO3 = c(0, 0, 0), Cl = c(42, 25, 16)), calculate_PI <- function(df, convert_units = FALSE)
This function calculates the Sodium Adsorption Ratio (SAR) for water quality.
calculate_sar(df, convert_units = FALSE)
calculate_sar(df, convert_units = FALSE)
df |
dataframe |
convert_units |
logical, for conversion to meq/l |
SAR values
This function calculates the total concentration (tc) based on the provided dataframe.
calculate_tc(df, convert_units = FALSE)
calculate_tc(df, convert_units = FALSE)
df |
Data frame containing the necessary columns. |
convert_units |
Logical, indicating whether to convert units from mg/l to meq/l. |
A numeric vector representing the total concentration (tc) for each row in the dataframe.
df <- data.frame(Ca = c(10, 20, 30), Mg = c(5, 10, 15), Na = c(8, 16, 24), Na = c(15, 25, 10), K = c(2, 6, 4), HCO3 = c(15, 30, 45), SO4 = c(110, 115, 88), CO3 = c(0, 0, 0), Cl = c(42, 25, 16)) calculate_tc(df, convert_units = TRUE)
df <- data.frame(Ca = c(10, 20, 30), Mg = c(5, 10, 15), Na = c(8, 16, 24), Na = c(15, 25, 10), K = c(2, 6, 4), HCO3 = c(15, 30, 45), SO4 = c(110, 115, 88), CO3 = c(0, 0, 0), Cl = c(42, 25, 16)) calculate_tc(df, convert_units = TRUE)
This vector defines the color palette used in the Wilcox diagram. It contains a sequence of color names.
CC
CC
An object of class character
of length 12.
This function calculates multiple water quality indices for irrigation.
irrigationALL(df, convert_to_meq = TRUE)
irrigationALL(df, convert_to_meq = TRUE)
df |
Dataframe containing necessary variables. |
convert_to_meq |
Logical, indicating whether to convert concentrations to meq/L (default: TRUE). |
Dataframe containing calculated indices: SAR, MAR, SCAR, RSC, RSBC, PI, KR, NaPercentage, and PS.
Kelly Ratio (KR) Calculation
KR(df, convert_to_meq = TRUE)
KR(df, convert_to_meq = TRUE)
df |
Dataframe containing necessary variables (Na, Ca). |
convert_to_meq |
Logical, indicating whether to convert concentrations to meq/L (default: TRUE). |
KR value.
Magnesium Adsorption Ratio (MAR) Calculation
MAR(df, convert_to_meq = TRUE)
MAR(df, convert_to_meq = TRUE)
df |
Dataframe containing necessary variables (Mg, Ca). |
convert_to_meq |
Logical, indicating whether to convert concentrations to meq/L (default: TRUE). |
MAR value.
Sodium Percentage (NaPercentage) Calculation
NaPercentage(df, convert_to_meq = TRUE)
NaPercentage(df, convert_to_meq = TRUE)
df |
Dataframe containing necessary variables (Na, Ca, Mg, K). |
convert_to_meq |
Logical, indicating whether to convert concentrations to meq/L (default: TRUE). |
Sodium Percentage value.
Permeability Index (PI) Calculation
PI(df, convert_to_meq = TRUE)
PI(df, convert_to_meq = TRUE)
df |
Dataframe containing necessary variables (Na, HCO3, Ca, Mg). |
convert_to_meq |
Logical, indicating whether to convert concentrations to meq/L (default: TRUE). |
PI value.
Plot Doneen diagram (High permeability) for all rows
plot_DoneenH( df, tc_column, PI_column, label_column = NULL, grp_column = NULL, convert_units = FALSE )
plot_DoneenH( df, tc_column, PI_column, label_column = NULL, grp_column = NULL, convert_units = FALSE )
df |
Data frame containing the necessary columns. |
tc_column |
Column name for total concentration (tc). |
PI_column |
Column name for PI (optional). |
label_column |
Column name for labels (optional). |
grp_column |
Column name for grouping (optional). |
convert_units |
Logical, whether to convert units. |
A ggplot object representing the USSL diagram. #' @examples df <- data.frame(tc = c(80, 65, 70), PI = c(30, 65, 150), Color = c("red", "green", "blue")) plot_DoneenH(df, tc_column = "tc", PI_column = "PI", label_column = NULL, grp_column = NULL, convert_units = FALSE)
This function plots the USSL diagram for the given data frame.
plot_DoneenL( df, tc_column, PI_column, label_column = NULL, grp_column = NULL, convert_units = FALSE )
plot_DoneenL( df, tc_column, PI_column, label_column = NULL, grp_column = NULL, convert_units = FALSE )
df |
Data frame containing the necessary columns. |
tc_column |
Column name for total concentration (tc). |
PI_column |
Column name for PI (optional). |
label_column |
Column name for labels (optional). |
grp_column |
Column name for grouping (optional). |
convert_units |
Logical, whether to convert units. |
A ggplot object representing the USSL diagram. #'@examples df <- data.frame(tc = c(80, 65, 70), PI = c(30, 65, 150), Color = c("red", "green", "blue")) plot_DoneenL(df, tc_column = "tc", PI_column = "PI", label_column = NULL, grp_column = NULL, convert_units = FALSE)
This function plots the USSL diagram for the given data frame.
plot_DoneenM( df, tc_column, PI_column, label_column = NULL, grp_column = NULL, convert_units = FALSE )
plot_DoneenM( df, tc_column, PI_column, label_column = NULL, grp_column = NULL, convert_units = FALSE )
df |
Data frame containing the necessary columns. |
tc_column |
Column name for total concentration (tc). |
PI_column |
Column name for PI (optional). |
label_column |
Column name for labels (optional). |
grp_column |
Column name for grouping (optional). |
convert_units |
Logical, whether to convert units. |
A ggplot object representing the USSL diagram. #' @examples df <- data.frame(tc = c(80, 65, 70), PI = c(30, 65, 150), Color = c("red", "green", "blue")) plot_DoneenM(df, tc_column = "tc", PI_column = "PI", label_column = NULL, grp_column = NULL, convert_units = FALSE)
This function plots the USSL diagram for the given data frame.
plot_Riverside( df, ec_column, sar_column, label_column = NULL, grp_column = NULL, convert_units = FALSE )
plot_Riverside( df, ec_column, sar_column, label_column = NULL, grp_column = NULL, convert_units = FALSE )
df |
containing values in relevant columns |
ec_column |
Column name for electrical conductivity (EC). |
sar_column |
Column name for SAR (optional). |
label_column |
Column name for labels (optional). |
grp_column |
Column name for grouping (optional). |
convert_units |
logical wether to convert from mg/l to meq/l |
A ggplot object representing the USSL diagram.
a numeric vector containing SAR values
df <- data.frame(EC = c(1000, 2000, 3000), SAR = c(20, 30, 40), Color = c("red", "green", "blue")) plot_Riverside(df, ec_column = "EC" , sar_column = "SAR",grp_column = "Color", convert_units= FALSE)
df <- data.frame(EC = c(1000, 2000, 3000), SAR = c(20, 30, 40), Color = c("red", "green", "blue")) plot_Riverside(df, ec_column = "EC" , sar_column = "SAR",grp_column = "Color", convert_units= FALSE)
This function plots the USSL diagram for the given data frame.
plot_USSL( df, ec_column, sar_column, label_column = NULL, grp_column = NULL, convert_units = FALSE )
plot_USSL( df, ec_column, sar_column, label_column = NULL, grp_column = NULL, convert_units = FALSE )
df |
Data frame containing the necessary columns. |
ec_column |
Column name for electrical conductivity (EC). |
sar_column |
Column name for SAR (optional). |
label_column |
Column name for labels (optional). |
grp_column |
Column name for grouping (optional). |
convert_units |
Logical, whether to convert units. |
A ggplot object representing the USSL diagram. #' @examples df <- data.frame(EC = c(1000, 2000, 3000), Na_percent = c(20, 30, 40), Group = c("red", "green", "blue")) plot_USSL(df, ec_column = "EC", sar_column = "SAR", label_column = NULL, grp_column = "Group", convert_units = FALSE)
This function plots the USSL diagram for the given data frame.
plot_Wilcox( df, ec_column, Napercent_column, label_column = NULL, grp_column = NULL, convert_units = FALSE )
plot_Wilcox( df, ec_column, Napercent_column, label_column = NULL, grp_column = NULL, convert_units = FALSE )
df |
containig relevant columns with values |
ec_column |
Column name for electrical conductivity (EC). |
Napercent_column |
Column name for Na percent (optional). |
label_column |
Column name for labels (optional). |
grp_column |
Column name for grouping (optional). |
convert_units |
logical wether to convert values from mg/l to meq/l |
A ggplot object representing the Wilcox diagram.
#' @examples f <- data.frame(EC = c(1000, 2000, 3000), Na_percent = c(20, 30, 40), Color = c("red", "green", "blue")) plot_Wilcox(f, ec_column = "EC", Napercent_column = "Na_percent", label_column = NULL, grp_column = "Color", convert_units = FALSE)
a numeric vector containing Na percent values
Potential Salinity (PS) Calculation
PS(df, convert_to_meq = TRUE)
PS(df, convert_to_meq = TRUE)
df |
Dataframe containing necessary variables (Cl, SO4). |
convert_to_meq |
Logical, indicating whether to convert concentrations to meq/L (default: TRUE). |
PS value.
Residual Sodium Bicarbonate (RSBC) Calculation
RSBC(df, convert_to_meq = TRUE)
RSBC(df, convert_to_meq = TRUE)
df |
Dataframe containing necessary variables (HCO3, Ca). |
convert_to_meq |
Logical, indicating whether to convert concentrations to meq/L (default: TRUE). |
RSBC value.
Residual Sodium Carbonate (RSC) Calculation
RSC(df, convert_to_meq = TRUE)
RSC(df, convert_to_meq = TRUE)
df |
Dataframe containing necessary variables (HCO3, CO3, Ca, Mg). |
convert_to_meq |
Logical, indicating whether to convert concentrations to meq/L (default: TRUE). |
RSC value.
Sodium Adsorption Ratio (SAR) Calculation
SAR(df, convert_to_meq = TRUE)
SAR(df, convert_to_meq = TRUE)
df |
Dataframe containing necessary variables (Na, Ca, Mg, K). |
convert_to_meq |
Logical, indicating whether to convert concentrations to meq/L (default: TRUE). |
SAR value.
Sodium Adsorption Ratio (SCAR) Calculation
SCAR(df, convert_to_meq = TRUE)
SCAR(df, convert_to_meq = TRUE)
df |
Dataframe containing necessary variables (Na, Ca). |
convert_to_meq |
Logical, indicating whether to convert concentrations to meq/L (default: TRUE). |
SCAR value.