Open Jhydromet opened 1 year ago
Love this function, but the catchment.shp export at the end is actually the channel data. Thankfully the catchment.tif is correct so I've been converting that to .shp.
My reproducible example is the help example (one day I"ll learn to make reprex).
Cheers
library(raster) test_raster <- ch_volcano_raster() dem_raster_file <- tempfile(fileext = c(".tif")) writeRaster(test_raster, dem_raster_file, format = "GTiff") wd <- tempdir() pourpoint_file <- tempfile("volcano_pourpoints", fileext = ".shp") pourpoints <- ch_volcano_pourpoints(pourpoint_file) catchment <- ch_wbt_catchment_onestep(wd = wd, in_dem = dem_raster_file, pp_sf = pourpoints, sink_method = "fill", threshold = 1, snap_dist = 10)
> devtools::session_info() ─ Session info ───────────────────────────────────────────────────────────────────────────────────────────────────────── setting value version R version 4.2.0 (2022-04-22 ucrt) os Windows 10 x64 (build 19045) system x86_64, mingw32 ui RStudio language (EN) collate English_Canada.utf8 ctype English_Canada.utf8 tz America/Los_Angeles date 2023-03-02 rstudio 2022.12.0+353 Elsbeth Geranium (desktop) pandoc 2.12 @ C:\\Users\\jmorris\\ANACON~1\\Scripts\\pandoc.exe ─ Packages ───────────────────────────────────────────────────────────────────────────────────────────────────────────── package * version date (UTC) lib source assertthat 0.2.1 2019-03-21 [1] CRAN (R 4.2.0) boot 1.3-28 2021-05-03 [2] CRAN (R 4.2.0) cachem 1.0.6 2021-08-19 [1] CRAN (R 4.2.0) callr 3.7.3 2022-11-02 [1] CRAN (R 4.2.2) circular 0.4-95 2022-04-26 [1] CRAN (R 4.2.2) class 7.3-20 2022-01-16 [2] CRAN (R 4.2.0) classInt 0.4-8 2022-09-29 [1] CRAN (R 4.2.2) cli 3.4.1 2022-09-23 [1] CRAN (R 4.2.1) codetools 0.2-18 2020-11-04 [2] CRAN (R 4.2.0) colorspace 2.0-3 2022-02-21 [1] CRAN (R 4.2.0) crayon 1.5.2 2022-09-29 [1] CRAN (R 4.2.2) CSHShydRology * 1.3.0 2022-11-16 [1] CRAN (R 4.2.0) DBI 1.1.3 2022-06-18 [1] CRAN (R 4.2.2) devtools 2.4.5 2022-10-11 [1] CRAN (R 4.2.2) digest 0.6.30 2022-10-18 [1] CRAN (R 4.2.2) dotCall64 1.0-2 2022-10-03 [1] CRAN (R 4.2.2) dplyr 1.0.10 2022-09-01 [1] CRAN (R 4.2.2) e1071 1.7-12 2022-10-24 [1] CRAN (R 4.2.2) ellipsis 0.3.2 2021-04-29 [1] CRAN (R 4.2.0) fansi 1.0.3 2022-03-24 [1] CRAN (R 4.2.0) farver 2.1.1 2022-07-06 [1] CRAN (R 4.2.2) fastmap 1.1.0 2021-01-25 [1] CRAN (R 4.2.0) fields 14.1 2022-08-12 [1] CRAN (R 4.2.2) fs 1.5.2 2021-12-08 [1] CRAN (R 4.2.0) generics 0.1.3 2022-07-05 [1] CRAN (R 4.2.2) ggplot2 3.4.0 2022-11-04 [1] CRAN (R 4.2.2) ggspatial 1.1.6 2022-07-08 [1] CRAN (R 4.2.2) glue 1.6.2 2022-02-24 [1] CRAN (R 4.2.0) gridExtra 2.3 2017-09-09 [1] CRAN (R 4.2.0) gtable 0.3.1 2022-09-01 [1] CRAN (R 4.2.2) here * 1.0.1 2020-12-13 [1] CRAN (R 4.2.0) htmltools 0.5.3 2022-07-18 [1] CRAN (R 4.2.2) htmlwidgets 1.5.4 2021-09-08 [1] CRAN (R 4.2.0) httpuv 1.6.6 2022-09-08 [1] CRAN (R 4.2.2) httr 1.4.4 2022-08-17 [1] CRAN (R 4.2.2) Kendall 2.2.1 2022-03-20 [1] CRAN (R 4.2.0) KernSmooth 2.23-20 2021-05-03 [2] CRAN (R 4.2.0) later 1.3.0 2021-08-18 [1] CRAN (R 4.2.0) lattice 0.20-45 2021-09-22 [2] CRAN (R 4.2.0) lifecycle 1.0.3 2022-10-07 [1] CRAN (R 4.2.1) lubridate 1.9.0 2022-11-06 [1] CRAN (R 4.2.2) magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.2.0) maps 3.4.1 2022-10-30 [1] CRAN (R 4.2.2) memoise 2.0.1 2021-11-26 [1] CRAN (R 4.2.0) mime 0.12 2021-09-28 [1] CRAN (R 4.2.0) miniUI 0.1.1.1 2018-05-18 [1] CRAN (R 4.2.0) munsell 0.5.0 2018-06-12 [1] CRAN (R 4.2.0) mvtnorm 1.1-3 2021-10-08 [1] CRAN (R 4.2.0) pillar 1.8.1 2022-08-19 [1] CRAN (R 4.2.2) pkgbuild 1.3.1 2021-12-20 [1] CRAN (R 4.2.0) pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.2.0) pkgload 1.3.2 2022-11-16 [1] CRAN (R 4.2.0) plotrix 3.8-2 2021-09-08 [1] CRAN (R 4.2.0) prettyunits 1.1.1 2020-01-24 [1] CRAN (R 4.2.0) processx 3.8.0 2022-10-26 [1] CRAN (R 4.2.2) profvis 0.3.7 2020-11-02 [1] CRAN (R 4.2.2) promises 1.2.0.1 2021-02-11 [1] CRAN (R 4.2.0) proxy 0.4-27 2022-06-09 [1] CRAN (R 4.2.2) ps 1.7.2 2022-10-26 [1] CRAN (R 4.2.2) purrr 0.3.5 2022-10-06 [1] CRAN (R 4.2.2) R6 2.5.1 2021-08-19 [1] CRAN (R 4.2.0) raster 3.6-3 2022-09-18 [1] CRAN (R 4.2.2) Rcpp 1.0.9 2022-07-08 [1] CRAN (R 4.2.2) remotes 2.4.2 2021-11-30 [1] CRAN (R 4.2.1) rgdal 1.6-2 2022-11-09 [1] CRAN (R 4.2.2) rlang 1.0.6 2022-09-24 [1] CRAN (R 4.2.1) rprojroot 2.0.3 2022-04-02 [1] CRAN (R 4.2.0) rstudioapi 0.14 2022-08-22 [1] CRAN (R 4.2.2) scales 1.2.1 2022-08-20 [1] CRAN (R 4.2.2) sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.2.0) sf 1.0-9 2022-11-08 [1] CRAN (R 4.2.2) shiny 1.7.3 2022-10-25 [1] CRAN (R 4.2.2) sp 1.5-1 2022-11-07 [1] CRAN (R 4.2.2) spam 2.9-1 2022-08-07 [1] CRAN (R 4.2.2) stringi 1.7.8 2022-07-11 [1] CRAN (R 4.2.1) stringr 1.4.1 2022-08-20 [1] CRAN (R 4.2.2) terra 1.6-17 2022-09-10 [1] CRAN (R 4.2.1) tibble 3.1.8 2022-07-22 [1] CRAN (R 4.2.2) tidyhydat 0.5.7 2022-10-16 [1] CRAN (R 4.2.2) tidyselect 1.2.0 2022-10-10 [1] CRAN (R 4.2.1) timechange 0.1.1 2022-11-04 [1] CRAN (R 4.2.2) timeDate 4021.106 2022-09-30 [1] CRAN (R 4.2.1) units 0.8-0 2022-02-05 [1] CRAN (R 4.2.0) urlchecker 1.0.1 2021-11-30 [1] CRAN (R 4.2.2) usethis 2.1.6 2022-05-25 [1] CRAN (R 4.2.2) utf8 1.2.2 2021-07-24 [1] CRAN (R 4.2.0) vctrs 0.5.1 2022-11-16 [1] CRAN (R 4.2.2) viridis 0.6.2 2021-10-13 [1] CRAN (R 4.2.0) viridisLite 0.4.1 2022-08-22 [1] CRAN (R 4.2.2) whitebox 2.2.0 2022-10-27 [1] CRAN (R 4.2.2) withr 2.5.0 2022-03-03 [1] CRAN (R 4.2.0) xtable 1.8-4 2019-04-21 [1] CRAN (R 4.2.0) [1] C:/Users/jmorris/AppData/Local/R/win-library/4.2 [2] C:/Program Files/R/R-4.2.0/library
Love this function, but the catchment.shp export at the end is actually the channel data. Thankfully the catchment.tif is correct so I've been converting that to .shp.
My reproducible example is the help example (one day I"ll learn to make reprex).
Cheers
library(raster) test_raster <- ch_volcano_raster() dem_raster_file <- tempfile(fileext = c(".tif")) writeRaster(test_raster, dem_raster_file, format = "GTiff") wd <- tempdir() pourpoint_file <- tempfile("volcano_pourpoints", fileext = ".shp") pourpoints <- ch_volcano_pourpoints(pourpoint_file) catchment <- ch_wbt_catchment_onestep(wd = wd, in_dem = dem_raster_file, pp_sf = pourpoints, sink_method = "fill", threshold = 1, snap_dist = 10)