...
 
Commits (12)
......@@ -85,3 +85,50 @@ NULL
#' @source \url{http://glatos.glos.us/home}
NULL
#' @title Example animal data from the OTN ERDDAP
#'
#' @description An example animal data file from the OTN ERDDAP
#'
#' @format CSV
##'
#' @name otn_aat_animals
#'
#' @section Filename: otn_aat_animals.csv
#'
#' @usage
#' system.file("extdata", "otn_aat_animals.csv", package = "glatos")
#'
#' @source Ryan Gosse, Ocean Tracking Network
NULL
#' @title Example station data from the OTN ERDDAP
#'
#' @description An example receiver station data file from the OTN ERDDAP
#'
#' @format CSV
##'
#' @name otn_aat_receivers
#'
#' @section Filename: otn_aat_receivers.csv
#'
#' @usage
#' system.file("extdata", "otn_aat_receivers.csv", package = "glatos")
#'
#' @source Ryan Gosse, Ocean Tracking Network
NULL
#' @title Example tag release data from the OTN ERDDAP
#'
#' @description An example tag release data file from the OTN ERDDAP
#'
#' @format CSV
##'
#' @name otn_aat_tag_releases
#'
#' @section Filename: otn_aat_tag_releases.csv
#'
#' @usage
#' system.file("extdata", "otn_aat_tag_releases.csv", package = "glatos")
#'
#' @source Ryan Gosse, Ocean Tracking Network
NULL
No preview for this file type
This diff is collapsed.
This diff is collapsed.
#Make internal data object blue_shark_att for testing
# (example data object)
#get blue shark example data
dtc_file <- system.file("extdata",
"blue_shark_detections.csv", package = "glatos")
shrk_det_file <- system.file("extdata", "blue_shark_detections.csv",
package = "glatos")
blue_shark_detections <- read_otn_detections(shrk_det_file)
#get path to example files from OTN ERDDAP
ani_erd_file <- system.file("extdata", "otn_aat_animals.csv",
package = "glatos")
animals <- read.csv(ani_erd_file, as.is = TRUE) # load the CSVs from ERDDAP
tags_erd_file <- system.file("extdata", "otn_aat_tag_releases.csv",
package = "glatos")
tags <- read.csv(tags_erd_file, as.is = TRUE)
rcv_erd_file <- system.file("extdata", "otn_aat_receivers.csv",
package = "glatos")
stations <- read.csv(rcv_erd_file, as.is = TRUE)
#Remove first row; (blank or metadata about the column)
animals <- animals[-1,]
tags <- tags[-1,]
stations <- stations[-1,]
#create ATT object
blue_shark_att <- convert_otn_erddap_to_att(blue_shark_detections,
tags, stations, animals)
#----------------------------------------------------
#add to sysdata.rda
rda_file <- file.path(".","R/sysdata.rda")
glatos:::add_internal_data(blue_shark_att, rda_file)
#for exported ('public') data
#devtools::use_data(walleye_detections, pkg = "..", overwrite = TRUE)
#Make internal data object walleye_att for testing
# (example data object)
#get path to example detections file
dtc_file <- system.file("extdata",
"walleye_detections.csv", package = "glatos")
#get path to example receiver file
rec_file <- system.file("extdata", "sample_receivers.csv",
package = "glatos")
#create new objects
walleye_detections <- read_glatos_detections(dtc_file)
rcv <- read_glatos_receivers(rec_file) # load receiver data
walleye_att <- convert_glatos_to_att(walleye_detections, rcv)
#----------------------------------------------------
#add to sysdata.rda
rda_file <- file.path(".","R/sysdata.rda")
glatos:::add_internal_data(walleye_att, rda_file)
#for exported ('public') data
#devtools::use_data(walleye_detections, pkg = "..", overwrite = TRUE)
......@@ -5,7 +5,7 @@
dtc_file <- system.file("extdata",
"walleye_detections.csv", package = "glatos")
#create new object
#create new objects
walleye_detections <- read_glatos_detections(dtc_file)
#----------------------------------------------------
......
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
......@@ -3,30 +3,29 @@
\name{convert_glatos_to_att}
\alias{convert_glatos_to_att}
\title{Convert detections and receiver metadata to a format that
ATT (https://github.com/vinayudyawer/ATT) accepts.}
ATT accepts.}
\usage{
convert_glatos_to_att(glatosObj, receiverObj)
convert_glatos_to_att(detectionObj, receiverObj)
}
\arguments{
\item{glatosObj}{a list from \code{read_glatos_detections}}
\item{detectionObj}{a list from \code{read_glatos_detections}}
\item{receiverObj}{a list from \code{read_glatos_receivers}}
}
\value{
a list of 3 tibble::tibbles containing tag dectections, tag metadata, and
station metadata, to be injested by VTrack/ATT
a list of 3 tibble::tibbles containing tag dectections, tag metadata,
and station metadata, to be ingested by VTrack/ATT
}
\description{
Convert detections and receiver metadata to a format that
ATT (https://github.com/vinayudyawer/ATT) accepts.
Convert \code{glatos_detections} and \code{glatos_receiver} objects to \code{ATT} for compatibility with the Animal Tracking Toolbox (\url{https://github.com/vinayudyawer/ATT}).
}
\details{
This function takes 2 lists containing detection and
reciever data and transforms them into 3 \code{tibble::tibble} objects
inside of a list. The input that AAT uses to get this data product
is located here: https://github.com/vinayudyawer/ATT/blob/master/README.md
and our mappings are found here: https://gitlab.oceantrack.org/GreatLakes/glatos/issues/83
in a comment by Ryan Gosse
This function takes 2 lists containing detection and reciever data
and transforms them into one list containing 3 \code{tibble::tibble}
objects. The input that AAT uses to get this data product is located here:
https://github.com/vinayudyawer/ATT/blob/master/README.md and our mappings
are found here: https://gitlab.oceantrack.org/GreatLakes/glatos/issues/83
in a comment by Ryan Gosse.
}
\examples{
......@@ -42,7 +41,7 @@ rec_file <- system.file("extdata", "sample_receivers.csv",
package = "glatos")
rcv <- read_glatos_receivers(rec_file) # load receiver data
ATTData <- convert_glatos_to_att(walleye_detections, rcv)
ATTdata <- convert_glatos_to_att(walleye_detections, rcv)
}
\author{
Ryan Gosse
......
......@@ -2,36 +2,39 @@
% Please edit documentation in R/util-convert_otn_erddap_to_att.r
\name{convert_otn_erddap_to_att}
\alias{convert_otn_erddap_to_att}
\title{Convert detections and receiver metadata to a format that
ATT (https://github.com/vinayudyawer/ATT) accepts.}
\title{Convert detections, transmitter, receiver, and animal metadata to a format
that ATT accepts.}
\usage{
convert_otn_erddap_to_att(glatosObj, erdTags, erdRcv, erdAni)
convert_otn_erddap_to_att(detectionObj, erdTags, erdRcv, erdAni)
}
\arguments{
\item{glatosObj}{a list from \code{read_glatos_detections}}
\item{detectionObj}{a data frame from \code{read_glatos_detections}}
\item{erdTags}{a list from the OTN ERDDAP of tags}
\item{erdTags}{a data frame with tag release data from the OTN ERDDAP}
\item{erdRcv}{a list from the OTN ERDDAP of receivers}
\item{erdRcv}{a data frame with receiver station data from the OTN ERDDAP}
\item{erdAni}{a list from the OTN ERDDAP of animals}
\item{erdAni}{a data frame with animal data from the OTN ERDDAP}
}
\value{
a list of 3 tibble::tibbles containing tag dectections, tag metadata, and
station metadata, to be injested by VTrack/ATT
a list of 3 tibble::tibbles containing tag dectections, tag metadata,
and station metadata, to be ingested by VTrack/ATT
}
\description{
Convert detections and receiver metadata to a format that
ATT (https://github.com/vinayudyawer/ATT) accepts.
Convert \code{glatos_detections} and transmitter, receiver, and animal
metadata from the OTN ERDDAP to \code{ATT} format for use in the Animal
Tracking Toolbox (\url{https://github.com/vinayudyawer/ATT}).
}
\details{
This function takes 4 lists containing detection, and
ERDDAP data from the tags receivers and animals tables, and transforms them into 3 \code{tibble::tibble} objects
inside of a list. The input that AAT uses to get this data product
is located here: https://github.com/vinayudyawer/ATT/blob/master/README.md
and our mappings are found here: https://gitlab.oceantrack.org/GreatLakes/glatos/issues/83
in a comment by Ryan Gosse. The OTN ERDDAP instance is here: https://members.oceantrack.org/erddap/tabledap/index.html
but please note that this only contains public data.
This function takes 4 data frames containing detection, and ERDDAP
data from the tags, receivers, and animals tables, and transforms them into
3 \code{tibble::tibble} objects inside of a list. The input that AAT uses
to get this data product is located here:
https://github.com/vinayudyawer/ATT/blob/master/README.md and our mappings
are found here: https://gitlab.oceantrack.org/GreatLakes/glatos/issues/83
in a comment by Ryan Gosse. The OTN ERDDAP instance is here:
https://members.oceantrack.org/erddap/tabledap/index.html but please note
that this only contains public data.
}
\examples{
......@@ -39,19 +42,32 @@ but please note that this only contains public data.
# EXAMPLE #1 - loading from the OTN ERDDAP + vignettes
library(glatos)
animals <- read.csv("/path/to/animal/csv/otn_aat_animals.csv") # load the CSVs from ERDDAP
tags <- read.csv("/path/to/tag/csv/otn_aat_tags.csv")
stations <- read.csv("/path/to/station/csv/otn_aat_stations.csv")
animals <- animals[-1,] # First row is garbage (blank or metadata about the column) so we can cut it
#get path to example files from OTN ERDDAP
ani_erd_file <- system.file("extdata", "otn_aat_animals.csv",
package = "glatos")
animals <- read.csv(ani_erd_file) # load the CSVs from ERDDAP
tags_erd_file <- system.file("extdata", "otn_aat_tag_releases.csv",
package = "glatos")
tags <- read.csv(tags_erd_file)
rcv_erd_file <- system.file("extdata", "otn_aat_receivers.csv",
package = "glatos")
stations <- read.csv(rcv_erd_file)
#Remove first row; (blank or metadata about the column)
animals <- animals[-1,]
tags <- tags[-1,]
stations <- stations[-1,]
#get blue shark example data
shrk_det_file <- system.file("extdata", "blue_shark_detections.csv",
package = "glatos")
blue_shark_detections <- read_glatos_detections(shrk_det_file) # load shark data
blue_shark_detections <- read_otn_detections(shrk_det_file) # load shark data
ATTData <- convert_otn_erddap_to_att(blue_shark_detections, tags, stations, animals)
ATTdata <- convert_otn_erddap_to_att(blue_shark_detections,
tags, stations, animals)
}
\author{
Ryan Gosse
......
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/extdata.r
\name{otn_aat_animals}
\alias{otn_aat_animals}
\title{Example animal data from the OTN ERDDAP}
\format{CSV}
\source{
Ryan Gosse, Ocean Tracking Network
}
\usage{
system.file("extdata", "otn_aat_animals.csv", package = "glatos")
}
\description{
An example animal data file from the OTN ERDDAP
}
\section{Filename}{
otn_aat_animals.csv
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/extdata.r
\name{otn_aat_receivers}
\alias{otn_aat_receivers}
\title{Example station data from the OTN ERDDAP}
\format{CSV}
\source{
Ryan Gosse, Ocean Tracking Network
}
\usage{
system.file("extdata", "otn_aat_receivers.csv", package = "glatos")
}
\description{
An example receiver station data file from the OTN ERDDAP
}
\section{Filename}{
otn_aat_receivers.csv
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/extdata.r
\name{otn_aat_tag_releases}
\alias{otn_aat_tag_releases}
\title{Example tag release data from the OTN ERDDAP}
\format{CSV}
\source{
Ryan Gosse, Ocean Tracking Network
}
\usage{
system.file("extdata", "otn_aat_tag_releases.csv", package = "glatos")
}
\description{
An example tag release data file from the OTN ERDDAP
}
\section{Filename}{
otn_aat_tag_releases.csv
}
context("Check convert_glatos_to_att")
#check against internal data object 'walleye_att' in R/sysdata.r
# Actual result
#get path to example detection file
wd_file <- system.file("extdata",
"walleye_detections.csv", package = "glatos")
wald <- read_glatos_detections(wd_file)
#get path to example receiver file
rec_file <- system.file("extdata", "sample_receivers.csv",
package = "glatos")
recd <- read_glatos_receivers(rec_file) # load receiver data
watt <- convert_glatos_to_att(wald, recd)
# Test using testthat library
test_that("walleye_att gives expected result", {
# Check if expected and actual results are the same
expect_equal(watt, walleye_att)
})
context("Check convert_otn_erddap_to_att")
#check against internal data object 'blue_shark_att' in R/sysdata.r
# Actual result
#get blue shark example data
dtc_file <- system.file("extdata",
"blue_shark_detections.csv", package = "glatos")
shrk_det_file <- system.file("extdata", "blue_shark_detections.csv",
package = "glatos")
blue_shark_detections <- read_otn_detections(shrk_det_file)
#get path to example files from OTN ERDDAP
ani_erd_file <- system.file("extdata", "otn_aat_animals.csv",
package = "glatos")
animals <- read.csv(ani_erd_file, as.is = TRUE) # load the CSVs from ERDDAP
tags_erd_file <- system.file("extdata", "otn_aat_tag_releases.csv",
package = "glatos")
tags <- read.csv(tags_erd_file, as.is = TRUE)
rcv_erd_file <- system.file("extdata", "otn_aat_receivers.csv",
package = "glatos")
stations <- read.csv(rcv_erd_file, as.is = TRUE)
#Remove first row; (blank or metadata about the column)
animals <- animals[-1,]
tags <- tags[-1,]
stations <- stations[-1,]
#create ATT object
bs_att <- convert_otn_erddap_to_att(blue_shark_detections,
tags, stations, animals)
# Test using testthat library
test_that("blue_shark_att gives expected result", {
# Check if expected and actual results are the same
expect_equal(bs_att, blue_shark_att)
})