Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sptf_whc12 may not be using the ptf the description says it uses #32

Open
BrentWHR opened this issue May 4, 2023 · 1 comment · May be fixed by #34
Open

sptf_whc12 may not be using the ptf the description says it uses #32

BrentWHR opened this issue May 4, 2023 · 1 comment · May be fixed by #34
Assignees

Comments

@BrentWHR
Copy link
Contributor

BrentWHR commented May 4, 2023

The function description says it Calculate the water holding capacity given the pedotransferfunction of Rawls & Brakensiek 1985
But the only calculation done in the code is:

soilptf/R/whc.R

Lines 610 to 662 in f352233

#' Calculate the water holding capacity given the pedotransferfunction of Rawls & Brakensiek 1985
#'
#' Note: Calculation of whc parameters may be wrong. The calculated water content is out of normal range. Original literature cannot be found on web.
#'
#' @inheritParams sptf_bd0
#'
#' @details
#' mp_fc must be either 10 or 33
#'
#'
#' @import data.table
#'
#' @references Rawls & Brakensiek (1985) Prediction of Soil Water Properties for Hydrologic Modelling
#'
#' @export
sptf_whc12 <- function(A_C_OF,A_CLAY_MI,A_SAND_MI) {
# Add visual bindings
theta_sat = theta_res = theta_fc = alfa = n = por = psi_b = lambda = theta_wp = NULL
D_BDS = NULL
# set default parameters for this function
mp_fc = 2.0
mp_wp = 4.2
# Check input
arg.length <-max(length(A_C_OF), length(A_CLAY_MI),length(A_SAND_MI))
checkmate::assert_numeric(A_C_OF, lower = 0, upper = 1000,len = arg.length)
checkmate::assert_numeric(A_CLAY_MI, lower = 0, upper = 100, len = arg.length)
checkmate::assert_numeric(A_SAND_MI, lower = 0, upper = 100, len = arg.length)
checkmate::assert_numeric(mp_wp, any.missing = FALSE)
checkmate::assert_subset(mp_fc, choices = c(2, 4.2))
# Collect data into a table
dt <- data.table(A_C_OF = A_C_OF,
A_CLAY_MI = A_CLAY_MI,
A_SAND_MI = A_SAND_MI,
value = NA_real_
)
# add density (with Corg in g/kg as input) in units g/cm3
dt[,D_BDS := (1617 - 77.4 * log(A_C_OF) - 3.49 * A_C_OF)*0.001]
# Calcaulte parameters of water retention curve of Brooks and Corey (1964)
dt[, value := calc_soil_porosity(D_BDS)]
# return value
value <- dt[, value]
# return value
return(value)
}

# add density (with Corg in g/kg as input) in units g/cm3
  dt[,D_BDS := (1617 - 77.4 * log(A_C_OF) - 3.49 * A_C_OF)*0.001]
  
  # Calcaulte parameters of water retention curve of Brooks and Corey (1964)
  dt[, value := calc_soil_porosity(D_BDS)]

Which suggests other functions are being used.

@gerardhros
Copy link
Collaborator

there are two items here. First the pedotransfer function is made by R & B as mentioned in the reference. But the pedotransfer functions are used to generate input parameters for another function describing the pF curve (in this case). Boorks and Corey have defined a pF curve description (similar to van Genuchten). So, that explains the "mismatch" in the comment made. Though, to be exact, i wonder whether the calc_soil_porosity here comes from Brooks and Corey. It can be deleted.

@BrentWHR BrentWHR linked a pull request May 4, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants