knitr::opts_chunk$set(fig.width = 10, fig.height = 10, tidy = TRUE, echo = FALSE) library(LITAP) library(gridExtra) library(ggplot2) if(is.null(params$rlim)) rlim <- "none" else rlim <- params$rlim if(is.null(params$clim)) clim <- "none" else clim <- params$clim # Get files files <- params$out_files read_output <- function(files) { x <- NULL if(any(stringr::str_detect(files, ".rds"))) { x <- readRDS(stringr::str_subset(files, ".rds")) } else if (any(stringr::str_detect(files, ".csv"))) { x <- readr::read_csv(stringr::str_subset(files, ".csv")) } else if(any(stringr::str_detect(files, ".dbf"))) { x <- foreign::read.dbf(stringr::str_subset(files, ".dbf")) } x } dem <- read_output(stringr::str_subset(files, "dem_fill")) pit <- read_output(stringr::str_subset(files, "stats_pit")) pond <- read_output(stringr::str_subset(files, "stats_pond")) fill <- read_output(stringr::str_subset(files, "stats_fill"))
Input File:
r params$file
Parameters:
r params$max_area
r params$max_depth
r params$nrow
r params$ncol
r rlim
r clim
LITAP version:
r packageVersion("LITAP")
cat(paste0("- [", basename(files), "](", files, ")\n"))
grid.arrange(flow_plot(db = dem, type = "relief") + labs(title = "relief"), flow_plot(db = dem, type = "elevation") + labs(title = "elevation"), nrow = 1)
grid.arrange(flow_plot(db = dem, type = "elevation", pits = TRUE, shed = TRUE, shed_type = "initial") + labs(title = "Initial Watersheds") + theme(plot.margin = unit(c(0, 0, 5 ,0), "mm")), flow_plot(db = dem, type = "elevation", pits = TRUE, shed = TRUE, shed_type = "local") + labs(title = "Local Watersheds")+ theme(plot.margin = unit(c(0, 0, 5 ,0), "mm")), # flow_plot(db = dem, type = "elevation", pits = TRUE, shed = TRUE, shed_type = "pond") + # labs(title = "Pond Watersheds")+ # theme(plot.margin = unit(c(5, 0, 0 ,0), "mm")), flow_plot(db = dem, type = "elevation", pits = TRUE, shed = TRUE, shed_type = "fill") + labs(title = "Fill Watersheds")+ theme(plot.margin = unit(c(5, 0, 0 ,0), "mm")), ncol = 2)
NOTE:
if(!is.null(pit)) DT::datatable(pit, rownames = FALSE) else message("No pit table")
if(!is.null(fill)) DT::datatable(fill, rownames = FALSE, filter = "none", options = list(ordering=F)) else message("No fill table")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.