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.
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
)
Character. Location of flow_mapper()
output
Character. Location of ARULE file. If NULL, A Rules are derived from the dem file (see Details).
Character. Location of CRULE file
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%).
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%).
Character. Which procedure to use. One of lsm
(Original LandMapR program) or bc_pem
(newer BC-PEM Direct-to-Site-Series
program).
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)
Logical. Remove all output files from previous runs in this folder?
Character. From which stage should the run be resumed? (see
Logical. Create log file recording progress?
Logical. Output extra progress messages.
Logical. Suppress all messages.
Logical. If TRUE, output files contain intermediate columns useful for debugging (e.g., 'buffer', 'seqno_buffer', etc.) Default FALSE.
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:
attributes
classes
@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 .
# 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)
#> CALCULATING DIRECTIONS
#> CALCULATING WATERSHEDS
#> REMOVING INITIAL PITS
#> CALCULATING POND (GLOBAL) WATERSHEDS
#> CALCULATING FILL PATTERNS
#> INVERTING DEM
#> CALCULATING INVERTED DIRECTIONS
#> CALCULATING INVERTED WATERSHEDS
#> REMOVING INVERTED PITS
#> CREATING REPORT
#> Run took: 0.25 min
# And form_mapper()
form_mapper(folder = "./testELEV/")
#> SETUP
#> CALCULATING FORM
#> CALCULATING WETNESS INDICES
#> CALCULATING RELIEF DERIVITIVES
#> CALCULATING SLOPE LENGTH
#> MERGING FLOW AND FORM DATA FOR `ALL_POINTS` FILE
#> Run took: 0.11 min
crule <- system.file("extdata", "crule.dbf", package = "LITAP")
# Run facet_mapper() - Derive A Rules
facet_mapper(folder = "./testELEV/", arule = NULL, crule = crule)
#> Using buffer of 4 rows ('edge_row') and 4 cols ('edge_col') per side
#> Formatting arule file
#> - Renaming 'slope' to 'slope_pct'
#> Formatting crule file
#>
#> CALCULATING FUZZY ATTRIBUTES
#> CALCULATING CLASSES
#> Run took: 0 min
# Derive A Rules, omitting rows and cols from the calculation
facet_mapper(folder = "./testELEV/", arule = NULL, crule = crule,
edge_row = 3, edge_col = 1)
#> Using buffer of 3 rows ('edge_row') and 1 cols ('edge_col') per side
#> Formatting arule file
#> - Renaming 'slope' to 'slope_pct'
#> Formatting crule file
#>
#> CALCULATING FUZZY ATTRIBUTES
#> CALCULATING CLASSES
#> Run took: 0 min
# 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)
#> Formatting arule file
#> - Renaming 'slope' to 'slope_pct'
#> Formatting crule file
#>
#> CALCULATING FUZZY ATTRIBUTES
#> CALCULATING CLASSES
#> Run took: 0.01 min
# Clean up (remove all output)
unlink("./testELEV/", recursive = TRUE)