-
Notifications
You must be signed in to change notification settings - Fork 1
/
README.Rmd
174 lines (123 loc) · 5.43 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
---
title: "LITAP"
output: github_document
---
<!-- badges: start -->
[![R-CMD-check](https://github.com/FRDC-SHL/LITAP/workflows/R-CMD-check/badge.svg)](https://github.com/FRDC-SHL/LITAP/actions)
<!-- badges: end -->
```{r, include = FALSE}
knitr::opts_chunk$set(fig.width = 15, fig.height = 10, eval = TRUE)
```
__Landscape Integrated Terrain Analysis Package (LITAP)__
LITAP is a software package aimed at providing open access code for terrain
analysis and landscape and hydrology models built on terrain attributes. A major
component of LITAP is founded on R. A. (Bob) MacMillan's LandMapR suite of
programs for flow topology and landform segmentation analyses with extended new
parameters and methodologies developed by Drs. Sheng Li and Steffi LaZerte.
Another component of LITAP focuses on the calculations and uses of directional
terrain attributes developed by Dr. Sheng Li. This project is actively under
development and we plan to add more features to support modelling of surficial
hydrology, soil erosion, landscape zoning, hydrologic response units and buffer
zone delineation.
LITAP is a project funded by Agriculture and Agri-Food Canada and
directed by [Dr. Sheng Li](https://profils-profiles.science.gc.ca/en/profile/sheng-li-phd).
See articles for new features specific to LITAP (coming soon)!
Currently LITAP includes major functions
- `flow_mapper()` - based on FlowMapR
- `form_mapper()` - based on FormMapR
- `facet_mapper()` - based on FacetMapR
- `wepp_mapper()` - based on WeppMapR
See the companion website for more details: <https://FRDC-SHL.github.io/LITAP/>
## Installation
Use the `remotes` package to directly install R packages from github:
```{r, eval = FALSE}
install.packages("remotes") # If not already installed
remotes::install_github("FRDC-SHL/LITAP")
```
## Example files
LITAP comes with several example files (`testELEV.dbf`, `testELEV_mini.dbf`,
`arule.dbf`, and `crule.dbf`). These are found in the "extdata" folder inside
the LITAP package folder. If you are unsure where this folder is, use the
function `system.file()`:
```{r, eval = FALSE}
system.file("extdata", package = "LITAP")
```
Now you can copy and paste these files to your working folder to try out the following examples.
```{r, include = FALSE}
file.copy(system.file("extdata", "testELEV.dbf", package = "LITAP"), ".")
file.copy(system.file("extdata", "arule.dbf", package = "LITAP"), ".")
file.copy(system.file("extdata", "crule.dbf", package = "LITAP"), ".")
```
## Basic Usage: Overall
```{r, eval = FALSE}
flow_mapper(file = "testELEV.dbf", nrow = 90, ncol = 90, grid = 5, out_folder = "Output/")
form_mapper(folder = "Output")
facet_mapper(folder = "Output", crule = "crule.dbf")
wepp_mapper(folder = "Output")
```
## Basic Usage: `flow_mapper()`
Load the package:
```{r}
library(LITAP)
```
First, specify the dem file and the number of rows and columns, as well as the
grid size, if it's not inferable from the data.
```{r, eval = FALSE}
flow_mapper(file = "testELEV.dbf", nrow = 90, ncol = 90, grid = 5)
```
Can also specify pit removal parameters:
```{r, eval = FALSE}
flow_mapper(file = "testELEV.dbf", nrow = 90, ncol = 90, grid = 5,
max_area = 5, max_depth = 0.2)
```
As well as the location of output files:
```{r}
flow_mapper(file = "testELEV.dbf", nrow = 90, ncol = 90, grid = 5, out_folder = "Output/")
```
## Basic Usage: `form_mapper()`
`form_mapper()` uses output from `flow_mapper()` and requires a grid size.
```{r}
form_mapper(folder = "Output/")
```
Optionally, users can also define channels and ridges according to the number of up-/down-slope cells that flow through the cell in question.
```{r, eval = FALSE}
form_mapper(folder = "Output/", str_val = 10000, ridge_val = 10000)
```
## Basic Usage: `facet_mapper()`
`facet_mapper()` uses output from `flow_mapper()` and `form_mapper()` and requires a CRULE file
and, optionally, an ARULE file.
```{r}
facet_mapper(folder = "Output/", crule = "crule.dbf", arule = "arule.dbf")
```
If an ARULE file is not provided, LITAP will derive the rules based on the input
files (as in Li et al. 2011, Canadian Journal of Soil Science 91(2), 251-266).
The derived A rules will be output to "afile_derived.csv".
```{r, eval = FALSE}
facet_mapper(folder = "Output/", crule = "crule.dbf")
```
## Basic Usage: `wepp_mapper()`
`wepp_mapper()` uses output from `flow_mapper()`
```{r, eval = FALSE}
wepp_mapper(folder = "Output/")
```
Optionally, users can also define the maximum length of channel cells
(after which they will be split into separate segments), as well as the
upslope threshold to define channel cells
```{r, eval = FALSE}
wepp_mapper(folder = "Output/", chan_length = 500, upslope_threshold = 500)
```
## Multiple file types
LITAP accepts multiple file types and can automatically assess the number of rows and columns, depending on the type (see `?load_file` for details and requirements):
```{r, eval = FALSE}
flow_mapper(file = "testELEV.csv")
flow_mapper(file = "testELEV.grd")
flow_mapper(file = "testELEV.flt")
```
## Output
Output files can be .csv or .rds (R data files) in the output folders "flow", "form", "facet" and "wepp". Additionally, an html report summarizing the `flow_mapper()` run is included in the output folder (`testELEV_final_report.html`).
See the [LITAP website](http://FRDC-SHL.github.io/LITAP/) for more details and examples
```{r, include = FALSE}
unlink("testELEV", recursive = TRUE)
unlink("Output", recursive = TRUE)
unlink(c("testELEV.dbf", "arule.dbf", "crule.dbf"))
```