View source: R/dsmartr_iterate.R
iterate | R Documentation |
Disaggregates an input soil map a given number of times.
iterate(
prepped_map = NULL,
covariates = NULL,
prepped_points = NULL,
id_field = NULL,
n_iterations = NULL,
t_factor = 10000,
c5_ctrl = NULL,
cpus = 1,
write_files = c("native", "rds"),
write_samples = FALSE,
resume_from = NULL
)
prepped_map |
Data Frame; Returned by
|
covariates |
RasterStack or RasterBrick; environmental covariate datasets. |
prepped_points |
Data Frame; Returned by
|
id_field |
String; name of unique polygon identifier field. |
n_iterations |
Integer; desired number of model runs. |
t_factor |
Integer; dirichlet distribution modifier. Where map units
have >1 soil class component, larger values of |
c5_ctrl |
List; output of |
cpus |
Integer; number of processors to use in parallel. |
write_files |
String; choose 'native' to write outputs in GeoTIFF, GPKG, or csv as appropriate, or 'rds' for outputs in RDS format. Note that map rasters are always written as GeoTIFF. |
write_samples |
Logical; whether to retain the covariate samples taken
during each iteration. If |
resume_from |
Integer; If this function is interrupted, it can be resumed from a specified iteration number (prevents overwriting existing model iterations in output directory). |
RasterStack; n_iterations
layers. As a side effect, for each
model run, outputs written to disk include the predicted soils map, the
C5.0 model summary, and optionally, the covariate sample points in spatial
data format.
This function writes a large number of files to disk.
## Not run:
# Polygons only:
# run prep_polygons() example code, then
iteration_maps <- iterate(prepped_map = pr_ap,
covariates = heronvale_covariates,
id_field = 'POLY_NO', n_iterations = 20,
cpus = max(1, (parallel::detectCores() - 1)),
write_files = 'native', write_samples = TRUE)
# Polygons, points and a C50 model tweak, no samples, rds output:
win_on <- C50::C5.0Control(winnow = TRUE)
iteration_maps <- iterate(prepped_map = pr_ap,
covariates = heronvale_covariates,
id_field = 'POLY_NO', prepped_points = pr_pts,
n_iterations = 20, c5_ctrl = win_on,
cpus = max(1, (parallel::detectCores() - 1)),
write_files = 'rds')
## Oh no, there was a blackout halfway through my model run:
iteration_maps_2 <- iterate(prepped_map = pr_ap,
covariates = heronvale_covariates,
id_field = 'POLY_NO', n_iterations = 6,
cpus = max(1, (parallel::detectCores() - 1)),
write_files = 'all', write_samples = TRUE,
resume_from = 14)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.