View source: R/sw_Pedotransfer_Functions.R
swrc_conversion | R Documentation |
Conversion between bulk soil water content and soil water potential
swrc_conversion(
direction = c("swp_to_vwc", "vwc_to_swp"),
x,
fcoarse,
layer_width,
swrc,
sand = NULL,
clay = NULL,
bdensity = NULL,
outer_if_equalsize = FALSE,
verbose = FALSE
)
swrc_swp_to_vwc(
swp_MPa,
fcoarse,
layer_width,
swrc = list(swrc_name = NULL, ptf_name = NULL, swrcp = NULL),
sand = NULL,
clay = NULL,
bdensity = NULL,
outer_if_equalsize = FALSE,
verbose = FALSE
)
swrc_vwc_to_swp(
vwcBulk,
fcoarse,
layer_width,
swrc = list(swrc_name = NULL, ptf_name = NULL, swrcp = NULL),
sand = NULL,
clay = NULL,
bdensity = NULL,
outer_if_equalsize = FALSE,
verbose = FALSE
)
direction |
A character string. Indicates the direction of soil water conversion. |
x |
A numeric value, vector, or matrix.
The soil water values to be converted,
either soil water potential (units |
fcoarse |
A numeric value or vector.
Coarse fragments, e.g., gravel, (> 2 mm; units of |
layer_width |
A numeric value or vector.
Depth interval, width, of each soil layer (units of |
swrc |
A named list.
Contains all necessary elements of a |
sand |
A numeric value or vector.
Sand content of the matric soil component
(< 2 mm fraction; units of |
clay |
A numeric value or vector.
Clay content of the matric soil component
(< 2 mm fraction; units of |
bdensity |
A numeric value or vector.
Density of the whole soil
(matric soil plus coarse fragments; units |
outer_if_equalsize |
A logical value.
Relevant only if |
verbose |
A logical value. If |
swp_MPa |
A numeric object. The soil water potential values
(units |
vwcBulk |
A numeric object. The volumetric water content values
(relative to the whole soil; units |
The dimensions of the output are a function of x
and the
number of soil values (e.g., rows or length of swrc[["swrcp"]]
).
The returned object has:
length l
if both x
and soils are of length l
.
length l
if x
has length l
and there is one soil.
length d
if x
is one value and soils are of length d
.
size l x d
if x
has length l
and soils are of length d
(if l
and d
are not equal or outer_if_equalsize
is TRUE
;
cf. the first case);
the d
sets of soil values are repeated for each value of x
.
size l x d
if x
has size l x d
and there is one soil.
the soil is repeated for each value of x
.
size l x d
if x
has size l x d
and soils are of length d
the d
sets of soil values are repeated for each row of x
.
swrc_swp_to_vwc()
: Convenience wrapper
to convert from SWP
to bulk VWC
with selected SWRC
swrc_vwc_to_swp()
: Convenience wrapper
to convert from bulk VWC
to matric SWP
with selected SWRC
swrc_names()
lists implemented SWRCs
;
ptf_names()
lists implemented PTFs
; and
check_ptf_availability()
checks availability of PTFs
.
For backward compatibility, fcoarse
and layer_width
may be missing.
If they are missing, then the soils are assumed to contain
0%
coarse fragments and be represented by 1 cm
wide soil layers.
Arguments sand
, clay
, and bdensity
are only required
if SWRC
parameter values need to be estimated on the fly,
i.e., if swrc
does not contain the element swrcp
(with suitable SWRC
parameter values).
This is handled by ptf_estimate()
and additionally requires
the element ptf_name
for argument swrc
.
If swrc
contains element swrcp
with one set of SWRC
parameters,
i.e., one row, then the parameter set is repeated for each value of x
.
If vwc
inputs represent the matric component
(instead of expected bulk values), then set fcoarse
to 0.
This works, however, only if swrcp
are provided or fcoarse
is not
utilized by the requested PTF
.
Cosby, B. J., G. M. Hornberger, R. B. Clapp, & T. R. Ginn. 1984. A statistical exploration of the relationships of soil moisture characteristics to the physical properties of soils. Water Resources Research, 20:682-690, \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1029/WR020i006p00682")}
ptf_estimate()
,
check_swrcp()
,
check_ptf_availability()
fsand <- c(0.5, 0.3)
fclay <- c(0.2, 0.1)
fcrs1 <- c(0, 0)
fcrs2 <- c(0.4, 0.1)
swrc1 <- list(
name = "Campbell1974",
swrcp = ptf_estimate(
sand = fsand,
clay = fclay,
fcoarse = fcrs1,
swrc_name = "Campbell1974",
ptf_name = "Cosby1984"
)
)
swrc_swp_to_vwc(-1.5, fcoarse = fcrs1, swrc = swrc1)
swrc_swp_to_vwc(c(-1.5, NA), fcoarse = fcrs1, swrc = swrc1)
swrc_swp_to_vwc(-1.5, fcoarse = fcrs1, sand = fsand, clay = fclay)
swrc_vwc_to_swp(c(0.10, 0.15, 0.20), fcoarse = fcrs1, swrc = swrc1)
swrc_vwc_to_swp(c(0.10, NA, 0.20), fcoarse = fcrs1, swrc = swrc1)
swrc2 <- list(
name = "Campbell1974",
swrcp = ptf_estimate(
sand = fsand,
clay = fclay,
fcoarse = fcrs2,
swrc_name = "Campbell1974",
ptf_name = "Cosby1984"
)
)
swrc_swp_to_vwc(-1.5, fcoarse = fcrs2, swrc = swrc2)
(1 - fcrs2) * swrc_swp_to_vwc(-1.5, swrc = swrc2)
swrc_swp_to_vwc(-1.5, fcoarse = fcrs2, sand = fsand, clay = fclay)
swrc_vwc_to_swp(c(0.10, 0.15, 0.20), fcoarse = fcrs2, swrc = swrc2)
# Available water holding capacity "AWC"
soils <- swSoils_Layers(rSOILWAT2::sw_exampleData)
p <- ptf_estimate(
sand = soils[, "sand_frac"],
clay = soils[, "clay_frac"],
fcoarse = soils[, "gravel_content"]
)
tmp <- swrc_swp_to_vwc(
c(-1.5, -0.033),
fcoarse = soils[, "gravel_content"],
swrc = list(name = "Campbell1974", swrcp = p)
)
awc <- diff(c(0, soils[, "depth_cm"])) * as.vector(diff(tmp))
# Shape of SWRCs
theta <- seq(0.05, 0.55, by = 0.001)
soils <- data.frame(
sand_frac = c(sand = 0.92, silty_loam = 0.17, silty_clay = 0.06),
clay_frac = c(0.03, 0.13, 0.58),
bd = c(1.614, 1.464, 1.437)
)
phi <- list(
Campbell1974 = swrc_vwc_to_swp(
theta,
sand = soils[, "sand_frac"],
clay = soils[, "clay_frac"],
swrc = list(swrc_name = "Campbell1974", ptf_name = "Cosby1984")
)
)
if (check_ptf_availability("Rosetta3")) {
phi[["vanGenuchten1980"]] <- swrc_vwc_to_swp(
theta,
sand = soils[, "sand_frac"],
clay = soils[, "clay_frac"],
bdensity = soils[, "bd"],
swrc = list(swrc_name = "vanGenuchten1980", ptf_name = "Rosetta3")
)
}
# Use PTF "neuroFX2021" to estimate parameters of SWRC `FXW`
## Not run:
# Set neuroFX2021 file path, see details in `ptf_neuroFX2021_for_FXW()`
options(RSW2_FILENEUROFX2021 = "path/to/sscbd.RData")
## End(Not run)
if (check_ptf_availability("neuroFX2021")) {
phi[["FXW"]] <- swrc_vwc_to_swp(
theta,
sand = soils[, "sand_frac"],
clay = soils[, "clay_frac"],
bdensity = soils[, "bd"],
swrc = list(swrc_name = "FXW", ptf_name = "neuroFX2021")
)
}
if (interactive() && requireNamespace("graphics")) {
par_prev <- graphics::par(mfcol = c(length(phi), 1))
for (k in seq_along(phi)) {
graphics::matplot(
theta, -phi[[k]],
type = "l",
log = "y",
xlim = c(0, max(theta)),
xlab = "theta [m/m]",
ylim = c(1e-4, 1e6),
ylab = "-phi [MPa]",
main = paste0("Soil Water Retention Curve (", names(phi)[k], ")")
)
graphics::abline(h = -c(-1.5, -0.033), col = "gray", lty = 3)
graphics::legend("topright", rownames(soils), col = 1:3, lty = 1:3)
}
graphics::par(par_prev)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.