-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' into dev-contrib-patch
- Loading branch information
Showing
49 changed files
with
1,945 additions
and
2,476 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
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,56 +1,62 @@ | ||
#' Loads the OTN receiver deployment metadata sheet to prepare it for use in | ||
#' `convert_otn_to_att` | ||
#' | ||
#' @param path the path to the deployment sheet | ||
#' | ||
#' @param header_line what line the headers are on | ||
#' | ||
#' @param sheet_name the sheet name or number containing the metadata | ||
#' | ||
#' @param combine_arr_stn whether or not to to join the station and array columns. Format depends on OTN node | ||
#' | ||
#' | ||
#' @details The function takes the path to the deployment sheet, what line to start | ||
#' reading from, and what sheet in the excel file to use. It converts column names | ||
#' to be used by `convert_otn_to_att`. | ||
#' | ||
#' @author Ryan Gosse | ||
#' | ||
#' @return a data.frame created from the excel file. | ||
#' | ||
#' @examples | ||
#' | ||
#' #-------------------------------------------------- | ||
#' # EXAMPLE #1 - loading from NSBS simplified Deployments | ||
#' | ||
#' library(glatos) | ||
#' deploy_path <- system.file("extdata", "hfx_deploy_simplified.xlsx", | ||
#' package = "glatos") | ||
#' | ||
#' deploy <- prepare_deploy_sheet(header_line, 5, 1) | ||
#' | ||
#' @export | ||
|
||
prepare_deploy_sheet <- function(path, header_line = 5, sheet_name = 1, combine_arr_stn = TRUE) { | ||
deploy_sheet <- readxl::read_excel(path, sheet = sheet_name, skip = header_line) | ||
deploy_sheet <- deploy_sheet %>% dplyr::rename( | ||
deploy_lat = DEPLOY_LAT, | ||
deploy_long = DEPLOY_LONG, | ||
ins_model_no = INS_MODEL_NO, | ||
deploy_date_time = `DEPLOY_DATE_TIME (yyyy-mm-ddThh:mm:ss)`, | ||
recover_date_time = `RECOVER_DATE_TIME (yyyy-mm-ddThh:mm:ss)`, | ||
station = STATION_NO | ||
|
||
) | ||
if (combine_arr_stn) { | ||
deploy_sheet <- deploy_sheet %>% dplyr::mutate( | ||
station = paste(OTN_ARRAY, station, sep = '') | ||
) | ||
} | ||
deploy_sheet <- deploy_sheet %>% dplyr::select( | ||
station, ins_model_no, deploy_lat, deploy_long, | ||
deploy_date_time, recover_date_time | ||
) | ||
return(deploy_sheet) | ||
|
||
} | ||
#' Loads the OTN receiver deployment metadata sheet to prepare it for use in | ||
#' \code{convert_otn_to_att} | ||
#' | ||
#' @param path the path to the deployment sheet | ||
#' | ||
#' @param header_line what line the headers are on | ||
#' | ||
#' @param sheet_name the sheet name or number containing the metadata | ||
#' | ||
#' @param combine_arr_stn whether or not to to join the station and array columns. Format depends on OTN node | ||
#' | ||
#' | ||
#' @details The function takes the path to the deployment sheet, what line to start | ||
#' reading from, and what sheet in the excel file to use. It converts column names | ||
#' to be used by \code{convert_otn_to_att}. | ||
#' | ||
#' @author Ryan Gosse | ||
#' | ||
#' @return a data.frame created from the excel file. | ||
#' | ||
#' @examples | ||
#' | ||
#' #-------------------------------------------------- | ||
#' # EXAMPLE #1 - loading from NSBS simplified Deployments | ||
#' | ||
#' library(glatos) | ||
#' deploy_path <- system.file("extdata", "hfx_deploy_simplified.xlsx", | ||
#' package = "glatos") | ||
#' | ||
#' deploy <- prepare_deploy_sheet(deploy_path, | ||
#' header_line = 1, | ||
#' sheet_name = 1) | ||
#' | ||
#' @export | ||
|
||
prepare_deploy_sheet <- function(path, header_line = 5, sheet_name = 1, combine_arr_stn = TRUE) { | ||
deploy_sheet <- readxl::read_excel(path, | ||
sheet = sheet_name, | ||
skip = header_line - 1, | ||
col_names = TRUE) | ||
|
||
deploy_sheet <- deploy_sheet %>% dplyr::rename( | ||
deploy_lat = DEPLOY_LAT, | ||
deploy_long = DEPLOY_LONG, | ||
ins_model_no = INS_MODEL_NO, | ||
deploy_date_time = `DEPLOY_DATE_TIME (yyyy-mm-ddThh:mm:ss)`, | ||
recover_date_time = `RECOVER_DATE_TIME (yyyy-mm-ddThh:mm:ss)`, | ||
station = STATION_NO | ||
|
||
) | ||
if (combine_arr_stn) { | ||
deploy_sheet <- deploy_sheet %>% dplyr::mutate( | ||
station = paste(OTN_ARRAY, station, sep = '') | ||
) | ||
} | ||
deploy_sheet <- deploy_sheet %>% dplyr::select( | ||
station, ins_model_no, deploy_lat, deploy_long, | ||
deploy_date_time, recover_date_time | ||
) | ||
return(deploy_sheet) | ||
|
||
} |
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,19 @@ | ||
#' Defunct functions in glatos | ||
#' | ||
#' These functions are gone, no longer available. | ||
#' | ||
#' \itemize{ | ||
|
||
#' \item \code{check_dependencies}: Removed in glatos 0.7.0. | ||
#' | ||
#' \item \code{install_ffmpeg}: Removed in glatos 0.7.0. | ||
#' | ||
#' \item \code{make_video_ffmpeg}: Removed in glatos 0.7.0. | ||
#' Use \code{\link{make_video}} instead. | ||
#' | ||
#' } | ||
#' | ||
#' | ||
#' @name glatos-defunct | ||
#' @aliases check_dependencies make_video_ffmpeg install_ffmpeg | ||
NULL |
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
Binary file not shown.
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,72 +1,8 @@ | ||
##' Check system dependencies necessary for package 'glatos' | ||
##' | ||
##' Checks to make sure external dependencies required by functions in | ||
##' 'glatos' are installed and available to R. | ||
##' | ||
##' @details `check_dependencies` checks that ffmpeg (cross platform software | ||
##' for manipulating video content) software are installed on your | ||
##' computer and accessible to R. FFmpeg is required to create or modify video | ||
##' animations of fish movement using the `make_frames`, | ||
##' `make_video`, and `adjust_video_playback` functions. | ||
##' | ||
##' @details When `check_dependencies` is executed, R attempts to | ||
##' sequentially access the external libraries. If the libraries | ||
##' are installed and accessible, a message is returned to the | ||
##' terminal stating that the check was successful. Failed attempts | ||
##' to access the external libraries are printed to the terminal. | ||
##' | ||
##' @details The simplest way to install FFMPEG for use by the 'glatos' package | ||
##' functions is to use the `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. | ||
##' `make_video` and other `glatos` functions that call ffmpeg will | ||
##' from that location. The downside to this method is that | ||
##' `install_ffmpeg` will need to be run each time the `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 | ||
##' <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 | ||
##' the path to the directory containing ffmpeg.exe | ||
##' | ||
##' @details Full installation of ffmpeg on Mac is similar to | ||
##' windows. First, download most recent build from | ||
##' <http://www.evermeet.cx/ffmpeg/>. The binary files are | ||
##' compressed with 7zip so may need toinstall an unarchiving | ||
##' utility (<http://wakaba.c3.cx/s/apps/unarchiver.html>) to | ||
##' extract the program folder. After the folder is extracted, copy | ||
##' the ffmpeg folder to /usr/local/bin/ffmpeg on your machine. | ||
##' | ||
##' @return A message is printed to the console. | ||
##' | ||
##' @author Todd Hayden, Chris Holbrook | ||
##' | ||
##' @examples | ||
##'\dontrun{ | ||
##' # run check | ||
##' check_dependencies() | ||
##' } | ||
##' | ||
##' @export | ||
|
||
|
||
check_dependencies <- function(){ | ||
#' @export | ||
check_dependencies <- function(...){ | ||
|
||
# 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(ffmpeg$value, "\n") | ||
} | ||
# FFmpeg is no longer needed. Function is now defunct | ||
.Defunct(new = NA, | ||
msg = "ffmpeg dependency is no longer needed by glatos package") | ||
|
||
} |
Oops, something went wrong.