Commit 1d9e86ee authored by Chris Holbrook's avatar Chris Holbrook

ensure check_dependencies checks for ffmpeg in glatos lib dir; fix #95

parent 014c507d
......@@ -2,8 +2,8 @@ Package: glatos
Type: Package
Title: A package for the Great Lakes Acoustic Telemetry Observation System
Description: Functions useful to members of the Great Lakes Acoustic Telemetry Observation System www.glatos.glos.us; many more broadly relevant to simulating, processing, analysing, and visualizing acoustic telemetry data.
Version: 0.4.1.9000
Date: 2019-11-13
Version: 0.4.1.9001
Date: 2020-02-12
Depends: R (>= 3.2.0)
Imports:
cellranger,
......@@ -53,6 +53,6 @@ Authors@R: c(
License: GPL-2
LazyLoad: yes
LazyData: true
RoxygenNote: 6.1.1
RoxygenNote: 7.0.2
VignetteBuilder: knitr
Encoding: UTF-8
......@@ -3,7 +3,7 @@
# glatos 0.4.1
#### 2019-11-13
#### 2020-02-12
### Bug fixes
......@@ -12,6 +12,15 @@
(e.g., `panel.first` and `panel.last`) had to be wrapped in `quote`
- fixes issue #87
- summarize_detections
- fix error in documentation listing all three summ_type options as
default
- fixes issue #94
- check_dependencies
- ensure that glatos package directory is checked for ffmpeg.exe
- fixes issue #95
----
# glatos 0.4.0
......
......@@ -31,15 +31,25 @@
##' available (Windows, Mac, and Linux) at
##' \url{https://qgis.org/en/site/forusers/download.html}.
##'
##' @details Installation of the ffmpeg library on windows is
##' @details The simplest way to install FFMPEG for use by the 'glatos' package
##' functions is to use the \code{install_ffmpeg} function, which downloads
##' the excecutable from one of the websites listed below (depending on
##' operating system) and places it in the 'glatos' package directory.
##' \code{make_video} and other \code{glatos} functions that call ffmpeg will
##' from that location. The downside to this method is that
##' \code{install_ffmpeg} will need to be run each time the \code{glatos}
##' package is re-installed. For more permanent installations of FFMPEG, see
##' directions below, by operating system.
##'
##' @details Full installation of the ffmpeg library on windows is
##' accomplished by downloading the recent 'static' build from
##' \url{http://ffmpeg.zeranoe.com/builds/}. After the download is
##' \url{http://ffmpeg.zeranoe.com/builds/}. After the download is
##' complete, use your favorite compression utility to extract the
##' downloaded folder. Decompress the package and store contents on
##' your computer. Last, Edit your system path variable to include
##' your computer. Last, edit your system path variable to include
##' the path to the directory containing ffmpeg.exe
##'
##' @details Installation of ffmpeg on Mac is similar to
##' @details Full installation of ffmpeg on Mac is similar to
##' windows. First, download most recent build from
##' \url{http://www.evermeet.cx/ffmpeg/}. The binary files are
##' compressed with 7zip so may need toinstall an unarchiving
......@@ -47,9 +57,9 @@
##' extract the program folder. After the folder is extracted, copy
##' the ffmpeg folder to /usr/local/bin/ffmpeg on your machine.
##'
##' @return results of checks to your terminal
##' @return A message is printed to the console.
##'
##' @author Todd Hayden
##' @author Todd Hayden, Chris Holbrook
##'
##' @examples
##'\dontrun{
......@@ -67,30 +77,30 @@ check_dependencies <- function(){
suppressWarnings(gdalUtils::gdal_setInstallation())
valid_install <- !is.null(getOption("gdalUtils_gdalPath"))
if(valid_install){
message(sprintf("OK... gdal version %s is installed",
getOption("gdalUtils_gdalPath")[[1]]$version))
message(sprintf(" OK... gdal version %s is installed",
getOption("gdalUtils_gdalPath")[[1]]$version), "\n")
} else {
message(paste0("gdal not found.\n",
"To install gdal, see:\n",
"\t- http://www.gdal.org\n",
"\t- https://trac.osgeo.org/osgeo4w\n",
"\t- https://trac.osgeo.org/gdal/wiki/DownloadingGdalBinaries\n",
"or to install QGIS (gis software), see:\n",
"\t- https://qgis.org/en/site/forusers/download.html"))
message(" gdal not found.\n",
" To install gdal, see:\n",
"\t- http://www.gdal.org\n",
"\t- https://trac.osgeo.org/osgeo4w\n",
"\t- https://trac.osgeo.org/gdal/wiki/DownloadingGdalBinaries\n",
" or to install QGIS (gis software), see:\n",
"\t- https://qgis.org/en/site/forusers/download.html")
}
# check for ffmpeg installation
message("Checking for ffmpeg...")
# check for FFmpeg
ffmpeg <- Sys.which("ffmpeg")
if(ffmpeg != ""){
message("OK... FFmpeg is installed and on system PATH.")
# check for ffmpeg
message("Checking for ffmpeg...")
ffmpeg <- tryCatch(list(found = TRUE, value = glatos:::get_ffmpeg_path(NA)),
error = function(e) list(found = FALSE, value = e$message))
# print message with result
if(ffmpeg$found) {
message(" OK... FFmpeg is installed at \n ", ffmpeg$value, ".", "\n")
} else {
message(paste0("FFmpeg not found.\n",
"To install in glatos package directory see \n",
"\t- ?install_ffmpeg\n",
"To install and set system PATH variable, see:\n",
"\t- https://www.ffmpeg.org\n",
"\t- ?check_dependencies"))
message(ffmpeg$value, "\n")
}
}
......@@ -98,16 +98,17 @@ get_ffmpeg_path <- function(ffmpeg){
ffVers <- suppressWarnings(system2(cmd, "-version", stdout=F)) #call ffmpeg
if(ffVers == 127)
stop(paste0('"ffmpeg" was not found.\n',
"See install_ffmpeg() to install into the package directory.\n",
"or ",
'ensure it is installed add added to system PATH variable\n',
"or specify path using input argument 'ffmpeg'\n\n",
'FFmpeg is available from:\n https://ffmpeg.org/\n',
'You may create the individual frames and then combine them\n',
'into an animation manually using video editing software\n',
'(e.g., Windows Movie Maker or iMovie) by setting the animate\n',
'argument to FALSE.'),
stop(" ffmpeg.exe was not found.\n\n",
" To install ffmpeg the easiest way (for use only by this package),\n",
" see ?install_ffmpeg to install into the glatos package directory.\n",
" Note that install_ffmpeg will need to be run each time the glatos\n",
" package is installed.\n\n",
" To install ffmpeg more permanently, download ffmpeg.exe from\n",
" https://ffmpeg.org/ and then either (1) add the path to directory\n",
" containing ffmpeg.exe to your operating system Path variable or\n",
" (2) in calls to glatos functions 'make_frames', 'make_video', \n",
" or 'adjust_playback_time', specify path to ffmpeg.exe using input\n",
" argument 'ffmpeg'.\n\n",
call. = FALSE)
return(ffmpeg)
......
......@@ -4,10 +4,18 @@
\alias{abacus_plot}
\title{Plot detection locations of acoustic transmitters over time}
\usage{
abacus_plot(det, location_col = "glatos_array", locations = NULL,
show_receiver_status = NULL, receiver_history = NULL,
out_file = NULL, x_res = 5, x_format = "\%Y-\%m-\%d",
outFile = NULL, ...)
abacus_plot(
det,
location_col = "glatos_array",
locations = NULL,
show_receiver_status = NULL,
receiver_history = NULL,
out_file = NULL,
x_res = 5,
x_format = "\%Y-\%m-\%d",
outFile = NULL,
...
)
}
\arguments{
\item{det}{A \code{glatos_detections} object (e.g., produced by
......
......@@ -4,9 +4,15 @@
\alias{adjust_playback_time}
\title{Modify playback time of video}
\usage{
adjust_playback_time(scale_factor = 1, input, output_dir = getwd(),
output = "new.mp4", overwrite = FALSE, ffmpeg = NA,
diagnostic_mode = FALSE)
adjust_playback_time(
scale_factor = 1,
input,
output_dir = getwd(),
output = "new.mp4",
overwrite = FALSE,
ffmpeg = NA,
diagnostic_mode = FALSE
)
}
\arguments{
\item{scale_factor}{multiplicative factor changes duration of
......
......@@ -4,8 +4,12 @@
\alias{calc_collision_prob}
\title{Estimate probability of collision for telemetry transmitters}
\usage{
calc_collision_prob(delayRng = c(60, 180), burstDur = 5,
maxTags = 50, nTrans = 10000)
calc_collision_prob(
delayRng = c(60, 180),
burstDur = 5,
maxTags = 50,
nTrans = 10000
)
}
\arguments{
\item{delayRng}{A 2-element numeric vector with minimum and maximum delay
......
......@@ -7,7 +7,7 @@
check_dependencies()
}
\value{
results of checks to your terminal
A message is printed to the console.
}
\description{
Checks to make sure external dependencies required by functions in
......@@ -42,15 +42,25 @@ Installation of the GDAL library and a number of other
available (Windows, Mac, and Linux) at
\url{https://qgis.org/en/site/forusers/download.html}.
Installation of the ffmpeg library on windows is
The simplest way to install FFMPEG for use by the 'glatos' package
functions is to use the \code{install_ffmpeg} function, which downloads
the excecutable from one of the websites listed below (depending on
operating system) and places it in the 'glatos' package directory.
\code{make_video} and other \code{glatos} functions that call ffmpeg will
from that location. The downside to this method is that
\code{install_ffmpeg} will need to be run each time the \code{glatos}
package is re-installed. For more permanent installations of FFMPEG, see
directions below, by operating system.
Full installation of the ffmpeg library on windows is
accomplished by downloading the recent 'static' build from
\url{http://ffmpeg.zeranoe.com/builds/}. After the download is
\url{http://ffmpeg.zeranoe.com/builds/}. After the download is
complete, use your favorite compression utility to extract the
downloaded folder. Decompress the package and store contents on
your computer. Last, Edit your system path variable to include
your computer. Last, edit your system path variable to include
the path to the directory containing ffmpeg.exe
Installation of ffmpeg on Mac is similar to
Full installation of ffmpeg on Mac is similar to
windows. First, download most recent build from
\url{http://www.evermeet.cx/ffmpeg/}. The binary files are
compressed with 7zip so may need toinstall an unarchiving
......@@ -66,5 +76,5 @@ check_dependencies()
}
\author{
Todd Hayden
Todd Hayden, Chris Holbrook
}
......@@ -4,8 +4,13 @@
\alias{crw}
\title{Simulate a correlated random walk}
\usage{
crw(theta = c(0, 5), stepLen = 10, initPos = c(0, 0),
initHeading = 0, nsteps = 10000)
crw(
theta = c(0, 5),
stepLen = 10,
initPos = c(0, 0),
initHeading = 0,
nsteps = 10000
)
}
\arguments{
\item{theta}{A 2-element numeric vector with turn angle parameters
......
......@@ -4,9 +4,17 @@
\alias{crw_in_polygon}
\title{Simulate a correlated random walk inside a polygon}
\usage{
crw_in_polygon(polyg, theta = c(0, 10), stepLen = 100,
initPos = c(NA, NA), initHeading = NA, nsteps = 30, EPSG = 3175,
sp_out = TRUE, show_progress = TRUE)
crw_in_polygon(
polyg,
theta = c(0, 10),
stepLen = 100,
initPos = c(NA, NA),
initHeading = NA,
nsteps = 30,
EPSG = 3175,
sp_out = TRUE,
show_progress = TRUE
)
}
\arguments{
\item{polyg}{A \code{\link[sp]{SpatialPolygons}} object.
......
......@@ -4,8 +4,14 @@
\alias{detect_transmissions}
\title{Simulate detection of transmitter signals in a receiver network}
\usage{
detect_transmissions(trnsLoc = NA, recLoc = NA, detRngFun = NA,
EPSG = 3175, sp_out = TRUE, show_progress = TRUE)
detect_transmissions(
trnsLoc = NA,
recLoc = NA,
detRngFun = NA,
EPSG = 3175,
sp_out = TRUE,
show_progress = TRUE
)
}
\arguments{
\item{trnsLoc}{A three-column data frame with locations (numeric columns
......
......@@ -4,10 +4,18 @@
\alias{detection_bubble_plot}
\title{Plot number of tagged animals or detections on a map}
\usage{
detection_bubble_plot(det, location_col = "glatos_array",
receiver_locs = NULL, map = NULL, out_file = NULL,
background_ylim = c(41.3, 49), background_xlim = c(-92.45, -75.87),
symbol_radius = 1, col_grad = c("white", "red"), scale_loc = NULL)
detection_bubble_plot(
det,
location_col = "glatos_array",
receiver_locs = NULL,
map = NULL,
out_file = NULL,
background_ylim = c(41.3, 49),
background_xlim = c(-92.45, -75.87),
symbol_radius = 1,
col_grad = c("white", "red"),
scale_loc = NULL
)
}
\arguments{
\item{det}{A \code{glatos_detections} object (e.g., produced by
......
......@@ -4,8 +4,12 @@
\alias{detection_events}
\title{Classify discrete events in detection data}
\usage{
detection_events(det, location_col = "glatos_array", time_sep = Inf,
condense = TRUE)
detection_events(
det,
location_col = "glatos_array",
time_sep = Inf,
condense = TRUE
)
}
\arguments{
\item{det}{A \code{glatos_detections} object (e.g., produced by
......
......@@ -4,8 +4,7 @@
\alias{false_detections}
\title{False detection filter}
\usage{
false_detections(det, tf, min_lag_col = "min_lag", show_plot = FALSE,
...)
false_detections(det, tf, min_lag_col = "min_lag", show_plot = FALSE, ...)
}
\arguments{
\item{det}{A \code{glatos_detections} object (e.g., produced by
......
......@@ -4,8 +4,7 @@
\alias{get_days}
\title{Determines which calculation method to use for the residency index.}
\usage{
get_days(dets, calculation_method = "kessel",
time_interval_size = "1 day")
get_days(dets, calculation_method = "kessel", time_interval_size = "1 day")
}
\arguments{
\item{dets}{- data frame pulled from the detection events}
......
......@@ -3,7 +3,6 @@
\docType{package}
\name{glatos}
\alias{glatos}
\alias{glatos-package}
\title{An R package for the Great Lakes Acoustic Telemetry Observation System}
\description{
\code{glatos} is an R package with functions useful to members of the Great
......
......@@ -4,9 +4,15 @@
\alias{interpolate_path}
\title{Interpolate new positions within a spatiotemporal path data}
\usage{
interpolate_path(det, trans = NULL, start_time = NULL,
int_time_stamp = 86400, lnl_thresh = 0.9, out_class = NULL,
show_progress = TRUE)
interpolate_path(
det,
trans = NULL,
start_time = NULL,
int_time_stamp = 86400,
lnl_thresh = 0.9,
out_class = NULL,
show_progress = TRUE
)
}
\arguments{
\item{det}{An object of class \code{glatos_detections} or data frame
......
......@@ -4,9 +4,18 @@
\alias{kml_workbook}
\title{Make a KML or KMZ file of receiver and animal release locations}
\usage{
kml_workbook(wb = NULL, wb_file = NULL, receiver_locs = NULL,
animals = NULL, kmz = FALSE, show_ongoing_recs = TRUE,
end_date = NULL, out_file = NULL, wb_version = NULL, ...)
kml_workbook(
wb = NULL,
wb_file = NULL,
receiver_locs = NULL,
animals = NULL,
kmz = FALSE,
show_ongoing_recs = TRUE,
end_date = NULL,
out_file = NULL,
wb_version = NULL,
...
)
}
\arguments{
\item{wb}{A \code{glatos_workbook} object created by
......
......@@ -4,12 +4,24 @@
\alias{make_frames}
\title{Create an animated video of spatiotemporal path data}
\usage{
make_frames(proc_obj, recs = NULL, out_dir = getwd(),
background_ylim = c(41.3, 49), background_xlim = c(-92.45, -75.87),
show_interpolated = TRUE, tail_dur = 0, animate = TRUE,
ani_name = "animation.mp4", frame_delete = FALSE,
overwrite = FALSE, ffmpeg = NA, preview = FALSE, bg_map = NULL,
show_progress = TRUE, ...)
make_frames(
proc_obj,
recs = NULL,
out_dir = getwd(),
background_ylim = c(41.3, 49),
background_xlim = c(-92.45, -75.87),
show_interpolated = TRUE,
tail_dur = 0,
animate = TRUE,
ani_name = "animation.mp4",
frame_delete = FALSE,
overwrite = FALSE,
ffmpeg = NA,
preview = FALSE,
bg_map = NULL,
show_progress = TRUE,
...
)
}
\arguments{
\item{proc_obj}{A data frame created by
......@@ -170,7 +182,7 @@ recs <- read_glatos_receivers(rec_file)
pos1 <- interpolate_path(dtc)
# make sequential frames and animation
# make sure ffmpeg is installed if argument \\code{animate = TRUE}
# make sure ffmpeg is installed if argument \code{animate = TRUE}
# If you have not added path to 'ffmpeg.exe' to your Windows PATH
# environment variable then you'll need to do that
# or set path to 'ffmpeg.exe' using the 'ffmpeg' input argument
......
......@@ -4,8 +4,13 @@
\alias{make_transition}
\title{Create transition layer from polygon shapefile}
\usage{
make_transition(in_file, output = "out.tif", output_dir = NULL,
res = c(0.1, 0.1), all_touched = TRUE)
make_transition(
in_file,
output = "out.tif",
output_dir = NULL,
res = c(0.1, 0.1),
all_touched = TRUE
)
}
\arguments{
\item{in_file}{A SpatialPolygonsDataFrame object or a character string with file path to
......
......@@ -4,8 +4,13 @@
\alias{make_transition2}
\title{Create transition layer from a spatial polygon}
\usage{
make_transition2(poly, res = c(0.1, 0.1), extent_out = NULL,
x_lim = NULL, y_lim = NULL)
make_transition2(
poly,
res = c(0.1, 0.1),
extent_out = NULL,
x_lim = NULL,
y_lim = NULL
)
}
\arguments{
\item{poly}{A spatial polygon object of class
......
......@@ -4,8 +4,7 @@
\alias{make_transition3}
\title{Create transition layer from polygon shapefile}
\usage{
make_transition3(poly, res = c(0.1, 0.1), receiver_points = NULL,
epsg = 3175)
make_transition3(poly, res = c(0.1, 0.1), receiver_points = NULL, epsg = 3175)
}
\arguments{
\item{poly}{A spatial polygon object of class
......
......@@ -4,12 +4,24 @@
\alias{make_video}
\title{Create video from sequence of still images}
\usage{
make_video(dir = getwd(), pattern, output = "animation.mp4",
output_dir = getwd(), fps_in = 30, start_frame = 1,
end_frame = NULL, size = "source", preset = "medium",
codec = "default", format = "yuv420p", lossless = FALSE,
fps_out = 30, overwrite = FALSE, ffmpeg = NA,
diagnostic_mode = FALSE)
make_video(
dir = getwd(),
pattern,
output = "animation.mp4",
output_dir = getwd(),
fps_in = 30,
start_frame = 1,
end_frame = NULL,
size = "source",
preset = "medium",
codec = "default",
format = "yuv420p",
lossless = FALSE,
fps_out = 30,
overwrite = FALSE,
ffmpeg = NA,
diagnostic_mode = FALSE
)
}
\arguments{
\item{dir}{directory containing images, default is working
......@@ -166,7 +178,7 @@ Presets provide a certain encoding speed to compression
frames <- system.file("extdata", "frames", package = "glatos")
# make .mp4 video
# make sure ffmpeg is on system path (see \\code{make_frames} and details)
# make sure ffmpeg is on system path (see \code{make_frames} and details)
make_video(dir = frames, pattern = "\%02d.png", output = "animation.mp4" )
# make .wmv video
......
......@@ -4,8 +4,13 @@
\alias{point_offset}
\title{Identify new location based on distance and bearing from another}
\usage{
point_offset(lon = NA, lat = NA, offsetDist = NA, offsetDir = NA,
distUnit = "m")
point_offset(
lon = NA,
lat = NA,
offsetDist = NA,
offsetDir = NA,
distUnit = "m"
)
}
\arguments{
\item{lon}{vector of longitudes (dd) to calculate offset points}
......
......@@ -4,11 +4,22 @@
\alias{position_heat_map}
\title{Position Heat Maps}
\usage{
position_heat_map(positions, projection = "LL", fish_pos_int = "fish",
abs_or_rel = "absolute", resolution = 10, interval = NULL,
x_limits = NULL, y_limits = NULL, utm_zone = NULL,
hemisphere = "N", legend_gradient = "y", legend_pos = c(0.99, 0.2,
1, 0.8), output = "plot", folder = "position_heat_map")
position_heat_map(
positions,
projection = "LL",
fish_pos_int = "fish",
abs_or_rel = "absolute",
resolution = 10,
interval = NULL,
x_limits = NULL,
y_limits = NULL,
utm_zone = NULL,
hemisphere = "N",
legend_gradient = "y",
legend_pos = c(0.99, 0.2, 1, 0.8),
output = "plot",
folder = "position_heat_map"
)
}
\arguments{
\item{positions}{A dataframe containing detection data with at least the
......
......@@ -4,9 +4,17 @@
\alias{receiver_line_det_sim}
\title{Simulate detection of acoustic-tagged fish crossing a receiver line}
\usage{
receiver_line_det_sim(vel = 1, delayRng = c(120, 360), burstDur = 5,
recSpc = 1000, maxDist = 2000, rngFun, outerLim = c(0, 0),
nsim = 1000, showPlot = FALSE)
receiver_line_det_sim(
vel = 1,
delayRng = c(120, 360),
burstDur = 5,
recSpc = 1000,
maxDist = 2000,
rngFun,
outerLim = c(0, 0),
nsim = 1000,
showPlot = FALSE
)
}
\arguments{
\item{vel}{A numeric scalar with fish velocity in meters per second.}
......
......@@ -4,9 +4,14 @@
\alias{residence_index}
\title{Generate the residence index from a set of detections}
\usage{
residence_index(detections, calculation_method = "kessel",
locations = NULL, group_col = "animal_id",
time_interval_size = "1 day", groupwise_total = TRUE)
residence_index(
detections,
calculation_method = "kessel",
locations = NULL,
group_col = "animal_id",
time_interval_size = "1 day",
groupwise_total = TRUE
)
}
\arguments{
\item{detections}{A data.frame from the \code{\link{detection_events}}
......
......@@ -4,8 +4,14 @@
\alias{transmit_along_path}
\title{Simulate telemetry transmitter signals along a path}
\usage{
transmit_along_path(path = NA, vel = 0.5, delayRng = c(60, 180),
burstDur = 5, EPSG = 3175, sp_out = TRUE)
transmit_along_path(
path = NA,
vel = 0.5,
delayRng = c(60, 180),
burstDur = 5,
EPSG = 3175,
sp_out = TRUE
)
}
\arguments{
\item{path}{A two-column data frame with at least two rows and columns
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment