check_POLARIS: Check that POLARIS soil data are locally available

View source: R/extract_soils_POLARIS.R

check_POLARISR Documentation

Check that POLARIS soil data are locally available

Description

Check that POLARIS soil data are locally available

Usage

check_POLARIS(
  path = ".",
  vars = c("bd", "sand", "clay", "silt"),
  stats = "mean"
)

Arguments

path

A character string. The path to the local copy of the POLARIS folder hierarchy, e.g., dirname(prepare_script_for_POLARIS()).

vars

A vector of character strings. See Chaney et al. 2019

stats

A vector of character strings. See Chaney et al. 2019

Value

A logical array with four dimensions:

File type

"vrt" or "tif"; if "vrt" is missing, then "tif" are not checked.

Variables

Checks for each vars.

Statistics

Checks for each stats.

Soil layer depths

Checks for each soil layer in POLARIS.

References

Chaney, N. W., B. Minasny, J. D. Herman, T. W. Nauman, C. Brungard, C. L. S. Morgan, A. B. McBratney, E. F. Wood, and Y. T. Yimam. 2019. POLARIS soil properties: 30-meter probabilistic maps of soil properties over the contiguous United States. Water Resources Research 55:2916-2938. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1029/2018WR022797")}.

Examples

script_to_download_polaris <- prepare_script_for_POLARIS()

## Execute script to download data
## (or set `path_polaris` to your local copy)

path_polaris <- dirname(script_to_download_polaris)
vars <- c("bd", "sand", "clay", "silt")
stat <- "mean"

## Check that we have POLARIS data
has_POLARIS <- check_POLARIS(path = path_polaris, vars = vars, stat = stat)

# Do we have all files?
isTRUE(all(has_POLARIS))

# If not, then examine
# (i) whether vrt files are missing, and/or
has_vrt <- !is.na(has_POLARIS["vrt", , , ]) & has_POLARIS["vrt", , , ]

# (ii) whether tif files are missing
has_tif <- !is.na(has_POLARIS["tif", , , ]) & has_POLARIS["tif", , , ]


DrylandEcology/rSW2exter documentation built on May 4, 2024, 10:53 p.m.