facet_mapper: Calculate landform facets using LSM logic

Description Usage Arguments Details Examples

View source: R/facet_mapper.R

Description

This function takes backup data frame output from flow_mapper() and form_mapper() calculates fuzzy attributes (among other metrics). Based on FacetMapR by R. A. (Bob) MacMillan, LandMapper Environmental Solutions.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
facet_mapper(
  folder,
  arule = NULL,
  crule,
  edge_row = NULL,
  edge_col = NULL,
  procedure = "lsm",
  zone = NULL,
  clean = FALSE,
  resume = NULL,
  log = TRUE,
  verbose = FALSE,
  quiet = FALSE,
  debug = FALSE
)

Arguments

folder

Character. Location of flow_mapper() output

arule

Character. Location of ARULE file. If NULL, A Rules are derived from the dem file (see Details).

crule

Character. Location of CRULE file

edge_row

Numeric. Number of rows to remove around the edge of the dem before deriving the A Rules. Default (NULL) results in removing 5% of the rows per side (total of 10%).

edge_col

Numeric. Number of cols to remove around the edge of the dem before deriving the A Rules. Default (NULL) results in removing 5% of the cols per side (total of 10%).

procedure

Character. Which procedure to use. One of lsm (Original LandMapR program) or bc_pem (newer BC-PEM Direct-to-Site-Series program).

zone

file. If procedure = "bc_pem", zones must either be defined for each seqno in the form dem file, OR must be provided as an index file here. With a zone defined for each seqno. zone file can be either dem (.dem), Excel (.xlsx, .xls), or text (.txt, .csv, .dat)

clean

Logical. Remove all output files from previous runs in this folder?

resume

Character. From which stage should the run be resumed? (see

log

Logical. Create log file recording progress?

verbose

Logical. Output extra progress messages.

quiet

Logical. Suppress all messages.

debug

Logical. If TRUE, output files contain intermediate columns useful for debugging (e.g., 'buffer', 'seqno_buffer', etc.) Default FALSE.

Details

Based on the technique described in Li et al. 2011, if no arule file is provided, the ARULE cutoffs are calculated from the form_mapper() dem files. These A Rules are saved as afile_derived.csv in the folder provided. The topographic derivative percentiles are stored to topographic_derivatives.csv, also in the folder.

Procedure lsm refers to the landform segmentation model (LSM) offered in the original LandMapR. Procedure bc_pem refers to calculating variables required for the British Columbia Predictive Ecosystem Mapping Direct-to-Site-Series program (BC-PEM DSS).

For resuming a run, resume must be one of the following:

@references Sheng Li, David A. Lobb, Brian G. McConkey, R. A. MacMillan, Alan Moulin, and Walter R. Fraser. 2011. Extracting topographic characteristics of landforms typical of Canadian agricultural landscapes for agri-environmental modeling. I. Methodology. Canadian Journal of Soil Science 91(2), 251-266. doi: 10.4141/CJSS10080.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# First need to run flow_mapper()
flow_mapper(file = system.file("extdata", "testELEV.dbf", package = "LITAP"),
           out_folder = "./testELEV/", nrow = 90, ncol = 90, grid = 5)

# And form_mapper()
form_mapper(folder = "./testELEV/")


crule <- system.file("extdata", "crule.dbf", package = "LITAP")

# Run facet_mapper() - Derive A Rules
facet_mapper(folder = "./testELEV/", arule = NULL, crule = crule)

# Derive A Rules, omitting rows and cols from the calculation
facet_mapper(folder = "./testELEV/", arule = NULL, crule = crule,
             edge_row = 3, edge_col = 1)

# Run facet_mapper() - supply A Rules
arule <- system.file("extdata", "arule.dbf", package = "LITAP")
crule <- system.file("extdata", "crule.dbf", package = "LITAP")
facet_mapper(folder = "./testELEV/", arule = arule, crule = crule)

# Clean up (remove all output)
unlink("./testELEV/", recursive = TRUE)

steffilazerte/LITAP documentation built on Feb. 9, 2022, 8:11 a.m.