parLamap: parLamap

Description Usage Arguments Value

Description

Parallel wrapper for the primary 'lamap' function. The wrapper is based on 'snow' clusters. It assumes that the cluster environment is such that the nodes share storage space—i.e., each has direct access to the same folder specified in the 'rasterpath' argument. It also assumes that the nodes have the same R environments, including all lamap functions and the knownsite_coords' and 'knownsite_pcdfs' objects. If your setup is different, you will have to create your own parallel scripts.

Usage

1
2
3
parLamap(cluster_object, rasterpath, outputpath, knownsite_pcdfs,
  knownsite_coords, steps, maxsites = NA, weightfun, weightparams,
  combinations = NA, nosupport = NA, partial = T)

Arguments

cluster_object

A 'snow' cluster returned by a function like 'makeCluster'—see the 'snow' package.

rasterpath

String. Path to geoTiff stack containing spatial variables. It will also provide the spatial meta data for the output lamap surface (i.e., it will define the prediction region and spatial resolution).

outputpath

String. Path to output folder.

knownsite_pcdfs

List of of lists containing cdfs for each known site. See 'pcdf()'.

knownsite_coords

Dataframe containing xy coordinates for each known site. The columns need to be named "id","x","y". The ids should be ordered to correspond to the order of sites in the knownsite_pcdfs list. For now, only UTM coordinates should be used.

steps

A vector of window sizes for each variable of interest. The steps will be used to estimate integrals from the knownsite_pcdfs. They will be added/subtracted from the observed values to create integration intervals. The order of steps in this vector must correspond to the order of column variables in the 'observed' dataframe—which must also match the order of columns in training dataframe—i.e., 'traindf'—passed to the 'pcdf' function.

maxsites

The maximum number of sites from the known-site training data to include in the calculations. This is primarily a convenience parameter that can be used to speed up calculations when the training set contains a large number of sites.

weightfun

The function used to weight the lamap values by distance. It can be one of 'uniform' or 'exponential'—see 'weight' function.

weightparams

A vector of parameters passed to the 'weight' function.

combinations

A conveience paramter used to speed up calculations. The lamap calculation involves the use of hte inclusion-exclusion principle for estimating the total probability of a union of independent events. Consequently, the R 'combn' function is used and can slow the calculations considerably. However, the user can instead use a utility function provided with this package—'prepCombinations'. It computes the combinations which can then be saved and passed to the lamap function with this parameter, saving the algorithm from having to regenerate the combinations for every cell in in the desired output map.

Value

Returns '1' when finished executing. The LAMAP output surface will be stored in the 'outputpath'.


wccarleton/lamap documentation built on May 23, 2019, 1:25 p.m.