Skip to content

Commit

Permalink
Merge branch 'dev' into dev-contrib-patch
Browse files Browse the repository at this point in the history
  • Loading branch information
mhpob authored Jan 5, 2024
2 parents 3637d18 + 57c9c41 commit 58b8dd0
Show file tree
Hide file tree
Showing 49 changed files with 1,945 additions and 2,476 deletions.
8 changes: 3 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ 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 https://glatos.glos.us; many more broadly relevant to simulating, processing, analysing, and visualizing acoustic telemetry data.
Version: 0.7.0.9000
Date: 2023-09-07
Depends: R (>= 3.2.0)
Version: 0.8.0.9000
Date: 2024-01-04
Depends: R (>= 3.5.0)
Imports:
av,
data.table,
Expand All @@ -20,14 +20,12 @@ Imports:
magrittr,
methods,
plotrix,
plotly,
plyr,
purrr,
raster,
readxl,
rmarkdown,
sf,
sp,
tibble,
tidyr
Suggests:
Expand Down
58 changes: 47 additions & 11 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

# glatos 0.7.0 (dev)
# glatos 0.8.0 (dev)


### Bug fixes
Expand Down Expand Up @@ -64,9 +64,50 @@

----

# glatos 0.6.5
# glatos 0.7.0 (2024-01-04)

#### 2023-09-07

### Bug fixes and minor changes

- Remove dependence on `rgeos` and `rgdal`.

- This package now requires R >= 3.5.0 because serialized objects in
serialize/load version 3 cannot be read in older versions of R.
File(s) containing such objects:
'glatos/inst/testdata/flynn_island_transition.rds'
'glatos/inst/testdata/higgins_lake_transition.rds'
'glatos/inst/testdata/test-detect_transmissions-dtc_spout.rds'
'glatos/inst/testdata/test-transmit_along_path-tr_dfin_spout.rds'

- Deprecate `make_transition` and `make_transition2`; suggest `make_transition3`
instead.

- Deprecate data object `greatLakesPoly`; suggest `great_lakes_polygon`
instead.

- `prepare_deploy_sheet`:
- Set 'skip = header_line - 1' and 'col_names = TRUE' to retain first
record and column names (read_excel ignores column names, unless set,
when skip is set).
- Fix non-working example code.

- `convert_otn_to_att` and `convert_otn_erddap_to_att`:
- Replaced `sp::CRS` with `sf::st_crs`
- Changed link (URL) to relevant issue from GitLab to GitHub repo.

- Remove ffmpeg functions.
- make defunct:
- `check_dependencies`
- `install_ffmpeg`
- `make_video_ffmpeg`

- Fix issues with several tests caused by changes to CRS/WKT and row.names
attributes.


----

# glatos 0.6.5 (2023-09-07)

### Bug fixes

Expand All @@ -75,9 +116,8 @@


----
# glatos 0.6.4

#### 2023-09-06
# glatos 0.6.4 (2023-09-06)

### Bug fixes and minor changes

Expand All @@ -88,9 +128,7 @@

----

# glatos 0.6.3

#### 2023-01-25
# glatos 0.6.3 (2023-01-25)

### Bug fixes and minor changes

Expand All @@ -101,9 +139,7 @@ code_map_comment columns.

----

# glatos 0.6.2

#### 2022-10-25
# glatos 0.6.2 (2022-10-25)

### Bug fixes and minor changes

Expand Down
15 changes: 9 additions & 6 deletions R/data.r
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
#' @title A SpatialPolygonDataFrame with Great Lakes coastline and some major
#' tributaries.
#'
#' @description A SpatialPolygonDataFrame with Great Lakes coastline and some
#' major tributaries. This is used as a default map background in several
#' [glatos] functions.
#' @title [Deprecated] A SpatialPolygonDataFrame with Great Lakes coastline and some major
#' tributaries.
#'
#' @description A SpatialPolygonDataFrame with Great Lakes coastline and some
#' major tributaries. This is used as a default map background in several
#' \link{glatos} functions.
#'
#' @details This dataset is deprecated and will be removed in a future version.
#' Use \code{\link{great_lakes_polygon}} instead.
#'
#' @author Todd Hayden
"greatLakesPoly"
Expand Down
118 changes: 62 additions & 56 deletions R/load-prepare_deploy_sheet.R
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)

}
19 changes: 19 additions & 0 deletions R/package-glatos-defunct.r
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
14 changes: 14 additions & 0 deletions R/package-glatos-deprecated.r
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,20 @@
#' the near future. When possible, alternative functions with similar
#' functionality are also mentioned. Help pages for deprecated functions are
#' available at \code{help("<function>-deprecated")}.
#'
#' These functions still work but will be removed (defunct) in the next version.
#'
#' \itemize{
#' \item \code{\link{make_transition}}: This function is deprecated, and will
#' be removed in the next version of this package.
#' Use \code{\link{make_transition3}} instead.
#' \item \code{\link{make_transition2}}: This function is deprecated, and will
#' be removed in the next version of this package.
#' Use \code{\link{make_transition3}} instead.
#' }
#'
#'
#' @name glatos-deprecated
#' @aliases make_transition-deprecated make_transition2-deprecated
#' @keywords internal
NULL
8 changes: 4 additions & 4 deletions R/sim-detect_transmissions.r
Original file line number Diff line number Diff line change
Expand Up @@ -338,10 +338,10 @@ detect_transmissions <- function(trnsLoc = NA ,
dtc.g <- data.frame(
trns_id = which(succ.g),
rec_id = g,
rec_x = sf::st_coordinates(recLoc_sf)[g, "X"],
rec_y = sf::st_coordinates(recLoc_sf)[g, "Y"],
trns_x = sf::st_coordinates(trnsLoc_sf)[succ.g, "X"],
trns_y = sf::st_coordinates(trnsLoc_sf)[succ.g, "Y"],
rec_x = sf::st_coordinates(recLoc_sf)[, "X"][g],
rec_y = sf::st_coordinates(recLoc_sf)[, "Y"][g],
trns_x = sf::st_coordinates(trnsLoc_sf)[, "X"][succ.g],
trns_y = sf::st_coordinates(trnsLoc_sf)[, "Y"][succ.g],
time = trnsLoc_sf$time[succ.g])

dtc <- rbind(dtc, dtc.g) #append
Expand Down
Binary file modified R/sysdata.rda
Binary file not shown.
74 changes: 5 additions & 69 deletions R/util-check_dependencies.r
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")

}
Loading

0 comments on commit 58b8dd0

Please sign in to comment.