View source: R/extract_soils_Miller1998_CONUSSoils.R
extract_soils_Miller1998_CONUSSoil | R Documentation |
Extract soil information from the CONUSSoil soil dataset for SOILWAT2 applications
extract_soils_Miller1998_CONUSSoil(
x,
crs = 4326,
path = ".",
vars = c("bd", "rockvol", "sand", "clay", "silt"),
lower_limits_by_vars = c(bd = 30, rockvol = 0, sand = 0, clay = 0, silt = 0),
replace_missing_fragvol_with_zero = c("none", "all", "at_surface"),
impute = FALSE,
digits = 3L,
verbose = FALSE
)
x |
A numerical two-dimensional object
(a |
crs |
An object which is a crs or from which one can be derived.
|
path |
A character string. The path to the local copy of the
CONUSSoil folder hierarchy, e.g.,
|
vars |
A vector of character strings. The requested variables as used by CONUSSoil; see Miller et al. 1998. |
lower_limits_by_vars |
A named numeric vector. The names correspond
to |
replace_missing_fragvol_with_zero |
A character string. Method
indicating how missing/null values of rock/gravel fragment fractions
should be interpreted;
passed to
|
impute |
A logical value. Impute missing values with a
shallow-depth value carried deeper approach (in analogy to LOCF).
Consequently, missing values in the shallowest horizon are not imputed.
See |
digits |
An integer value. The number of digits to which soil texture
variables are rounded. Skip rounding if |
verbose |
A logical value. |
A local copy of CONUSSoil is required. The function
prepare_script_for_Miller1998_CONUSSoil
creates a script
that can be used to download and prepare CONUSSoil files.
Miller, D. A., and R. A. White. 1998. A conterminous United States multilayer soil characteristics dataset for regional climate and hydrology modeling. Earth Interactions 2:1-26. http://www.soilinfo.psu.edu/index.cgi?soil_data&conus
extract
script_to_download_conussoil <- prepare_script_for_Miller1998_CONUSSoil()
## Execute script to download data
## (or set `path_conussoil` to your local copy)
path_conussoil <- dirname(script_to_download_conussoil)
## Mask out unrealistic variable values
has_CONUSSoil_cond <- create_conditioned_Miller1998_CONUSSoil(
path = path_conussoil
)
## Check that we have CONUSSoil data
has_CONUSSoil <- isTRUE(all(
check_Miller1998_CONUSSoil(path = path_conussoil)
))
if (has_CONUSSoil) {
locations <- matrix(
data = c(-120.1286878, -111.8511136, 39.8182913, 36.9047396),
nrow = 2
)
res <- extract_soils_Miller1998_CONUSSoil(
x = locations,
path = path_conussoil,
verbose = TRUE
)
}
# Clean up example
unlink(script_to_download_conussoil)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.