Skip to contents

This function expects an sf object as its first argument that contains only geometry of type POLYGON or MULTIPOLYGON. Each row of the object is considered a single asset in the portfolio for which biodiversity indicators will be calculated further down the processing chain. Some preliminary checks are conducted, e.g. that the CRS of the object is EPSG:4326 otherwise it will be transformed. Some portfolio wide parameters such as the output directory for downloaded data sets, a temporal directory for intermediate calculations can be set by the user to have more fine-control of the workflow. However, these parameters are also set to sensible defaults and thus can be omitted during portfolio initialization.

Usage

init_portfolio(
  x,
  years,
  outdir = getwd(),
  tmpdir = tempdir(),
  cores = NULL,
  add_resources = TRUE,
  aria_bin = NULL,
  verbose = TRUE
)

Arguments

x

The sf object to be transformed to a portfolio

years

Numeric vector for time frame of the analysis handed over as a vector of consecutive years

outdir

Character indicating the directory where resources will be written to. If the directory does not exist, we will attempt to create it. The output director cannot be equal to the temporary directory. Defaults to the current working directory.

tmpdir

Character vector to a directory used for intermediate files. Defaults to the output of tempdir(), e.g. the current R session's temporal directory. If a custom file path does not exist, we will attempt to create it. Cannot be equal to the output directory. Note, that for raster calculations we will set the temporal directory for the terra package here. Please make sure that enough disk space is available because some intermediate calculations can become quite large.

cores

Deprecated. Use future-style parallelzation instead.

add_resources

Logical if existing resources in 'outdir' should be added to the portfolio. Defaults to TRUE. Setting it to FALSE can be of use e.g. if a previous download has terminated unexpectedly in order to resume.

aria_bin

A character vector to an aria2c executable for parallel downloads

verbose

Logical, defaults to TRUE, indicating if progress information is printed.

Value

The sf portfolio object x with amended attributes controlling the processing behaviour further down the processing chain.