-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from FRDC-SHL/dev
# LITAP 0.6.0 - Import x/y coords or create them if they don't exist - flow_mapper() now requires grid or infers from x/y value of input files - form_mapper() and wepp_mapper() now use grid inferred from x/y value of flow_mapper() output files - flow_mapper() now has upslope_m (upslope cells * grid^2) - flow_mapper() calculates UCED - facet_mapper() calculates buffer edges - Simplify output with 'debug' argument (if false, removes intermediate files) - Simplify output columns by removing intermediate ones - Remove option to 'end' a run prematurely (required due to simplified output) - Remove dbf output option because it truncates column names - Fix flow_mapper() inconsistencies - Add extra data output "topographical_derivatives" in facet_mapper - Initial work on all_points data output
- Loading branch information
Showing
251 changed files
with
969,721 additions
and
4,679 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
Package: LITAP | ||
Type: Package | ||
Title: Landscape Integrated Terrain Analysis Package | ||
Version: 0.5.0 | ||
Version: 0.6.0 | ||
Authors@R: c( | ||
person("Steffi", "LaZerte", email = "[email protected]", role = c("aut","cre")), | ||
person("Sheng", "Li", email = "[email protected]", role = "aut"), | ||
|
@@ -34,15 +34,17 @@ Imports: | |
stringr (>= 1.2.0), | ||
tibble (>= 2.1.3), | ||
tidyselect (>= 1.1.0), | ||
tidyr (>= 1.0.0) | ||
tidyr (>= 1.0.0), | ||
writexl (>= 1.4.0) | ||
Suggests: | ||
gt (>= 0.3.1), | ||
foreign (>= 0.8.67), | ||
knitr, | ||
microbenchmark, | ||
readxl, | ||
rgdal, | ||
testthat (>= 3.0.0) | ||
VignetteBuilder: knitr | ||
RoxygenNote: 7.1.1 | ||
RoxygenNote: 7.1.2 | ||
Roxygen: list(markdown = TRUE) | ||
Config/testthat/edition: 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#' Combine flow and form output dems | ||
#' | ||
#' `flow_mapper()` and `form_mapper()` each provide output information per cell | ||
#' of a dem file. This function takes the fill dem from `flow_mapper()` as well | ||
#' as the length and weti dem files from `form_mapper()` and merges them | ||
#' together into a complete dem file with all information. This file is saved | ||
#' to the project folder. | ||
#' | ||
#' @param folder Character. Folder with previous LITAP runs (i.e. where output | ||
#' of `flow_mapper()` etc. are) | ||
#' @param out_format Character. Output format (rds or csv) that merged file | ||
#' should be saved as (if different from the rest; by default uses the format | ||
#' of the other LITAP output files) | ||
|
||
merge_all <- function(folder, out_format = NULL) { | ||
|
||
# Get current out format | ||
ext <- get_format(folder, where = "flow") | ||
if(!is.null(out_format)) { | ||
check_out_format(out_format) | ||
ext <- out_format | ||
} | ||
|
||
flow <- get_previous(folder, step = "fill", where = "flow") %>% | ||
dplyr::select(-"ridge") | ||
|
||
flow_stats <- get_previous(folder, step = "fill", where = "flow", type = "stats") | ||
|
||
inv <- get_previous(folder, step = "inverted", where = "flow") %>% | ||
dplyr::select("seqno", "ddir", "drec", "upslope", "upslope_m", | ||
"inv_initial_shed", "inv_local_shed", "edge_map") %>% | ||
dplyr::rename_with(.cols = -c("seqno", dplyr::contains("inv_")), | ||
~paste0("inv_", .)) | ||
inv_stats <- get_previous(folder, step = "inverted", where = "flow", type = "stats") | ||
|
||
length <- get_previous(folder, step = "length", where = "form") | ||
|
||
weti <- get_previous(folder, step = "form", where = "form") | ||
|
||
combo <- dplyr::left_join(flow, inv, by = "seqno") %>% | ||
dplyr::left_join(length, | ||
by = c("seqno", "x", "y", "row", "col", "elev")) %>% | ||
dplyr::left_join(weti, | ||
by = c("seqno", "x", "y", "row", "col", | ||
"elev", "drec", "upslope")) | ||
|
||
name <- paste0("all_points.", ext) | ||
if(ext == "rds") readr::write_rds(combo, file.path(folder, name)) | ||
if(ext == "csv") readr::write_csv(combo, file.path(folder, name), progress = FALSE) | ||
combo | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.