This file contains hidden or 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
| # Converting coordinates from DMS or DdM formats to decimal | |
| # DMS = "degrees minutes seconds"; DdM = "degrees decimal minutes" | |
| # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
| dg2dec <- function(varb, Dg=NA, Min=NA, Sec=NA, SW.Hemisphere="S|W") { | |
| # Dg=decimal, Min=minutes and Sec=seconds; | |
| # NOTE 1 - if the format is "degrees decimal minutes - DdM" (e.g. 40° 26.767′ N) and not | |
| # "degrees minutes seconds - DMS" (e.g. 40° 26′ 46″ N), then call the function only with | |
| # Dg and Min arguments, like dg2dec(varb, Dg="°", Min="′N"). | |
| # Same applies when there is no seconds symbol (e.g. 45°12'7.38). | |
| # Note that one should not use blank spaces in Dg, Min or Sec arguments (will return NA). |
This file contains hidden or 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
| #Load Packages and data files: | |
| library(sf) | |
| library(terra) | |
| library(tidyverse) | |
| #Function: | |
| PunchCulverts <- function( | |
| rasterFile = "raster/DEM.tif", | |
| culvertFile = "vector/culverts.shp", | |
| newRasterFile = "raster/DEM_punched.tif" |
This file contains hidden or 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
| library(magick) | |
| library(tesseract) | |
| library(tidyverse) | |
| white <- image_read("C:/Users/adamcummings/Box/01. adam.cummings Workspace/Childs Camera Traps/white.png") | |
| get_temperature <- function(image){ | |
| #crop: | |
| crop <- image_crop(image, "75x32+1880") %>% |
This file contains hidden or 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
| library(terra) | |
| library(shapefiles) | |
| allTaudem <- function(rasterDir="dir/dir2", | |
| rasterName="raster.tif", | |
| shortName = "auto", | |
| threshold = .01, # either <1 it calculates as a percent of the max accum cell or >1 as the accum threshold | |
| saveHillshade=FALSE, | |
| quiet=TRUE){ | |
| oldWD <- getwd() |