library(matos)
#> By continuing, you are agreeing to the ACT Network MATOS User Agreement and
#> Data Policy, Version 1.2:
#>
#> <https://matos.asascience.com/static/MATOS.User.Agreement.V1.1.pdf>
#>
Oh, boy; oh, boy! Here it is: one of the three yearly data pushes and Kim has hit you with a slew of automated emails to let you know that the data you’ve recorded on your receivers has been matched to other projects in MATOS or one of the other OTN nodes.
What now? What’s been updated? Who might I contact for more
information? Well, make_receiver_push_summary
and
make_tag_push_summary
are here to help.
ACT members
If you’re an ACT member, the first thing you’ll want to do is list the projects for which you have access.
list_my_projects(read_access = T)
#> ! Please log in.
#> ✔ Login successful!
#> name number
#> 32 Maryland Department of Natural Resources 90
#> 41 Navy Kennebec ME Telemetry Array 192
#> 45 NCBO-MD DNR Chesapeake Backbone North 181
#> 46 NCBO-VMRC Chesapeake Backbone South 164
#> 104 UMCES Black Sea Bass & Offshore Construction 97
#> 105 UMCES BOEM Offshore Wind Energy 87
#> 106 UMCES Chesapeake Backbone, Mid-Bay 161
#> 107 UMCES Lower Hudson Striped Bass Contingents 155
#> 108 UMCES Potomac River Striped Bass Migration 60
#> 109 UMCES Resident Hudson Striped Bass Migration 160
#> 110 UMCES Striped Bass Thermal Squeeze 152
#> 111 UMCES-NYSDEC Hudson Striped Bass Spawning 127
#> url
#> 32 https://matos.asascience.com/project/detail/90
#> 41 https://matos.asascience.com/project/detail/192
#> 45 https://matos.asascience.com/project/detail/181
#> 46 https://matos.asascience.com/project/detail/164
#> 104 https://matos.asascience.com/project/detail/97
#> 105 https://matos.asascience.com/project/detail/87
#> 106 https://matos.asascience.com/project/detail/161
#> 107 https://matos.asascience.com/project/detail/155
#> 108 https://matos.asascience.com/project/detail/60
#> 109 https://matos.asascience.com/project/detail/160
#> 110 https://matos.asascience.com/project/detail/152
#> 111 https://matos.asascience.com/project/detail/127
From here, you can just provide your project name or number and let it rip. Below, I provide the number associated with “UMCES BOEM Offshore Wind Energy”.
This function does a bit of data cleaning on the front end and then runs everything through a Quarto or RMarkdown report. The functions use Quarto by default, but RMarkdown will be selected if:
- Quarto is not installed on the computer, or
- the
rmd
argument is set toTRUE
.
# Compiles with Quarto (default)
make_receiver_push_summary(87, rmd = F)
# Compiles with RMarkdown
make_receiver_push_summary(87, rmd = T)
Functionality is identical for
make_tag_push_summary
:
Other OTN-ites
If you are a member of OTN or an OTN node, such as FACT, your data extract files are
compatible with make_receiver_push_summary
and
make_tag_push_summmary
. The only difference is that you’ll
have to manually provide your data files – matos
is not set
up to download them for you.
We’ll use data from Trudel 2018 (https://members.oceantrack.org/data/repository/pbsm) to show how this might work.
make_receiver_push_summary
# Create a folder in your temporary directory to hold the sample files
td <- file.path(tempdir(), 'matos_test_files')
dir.create(td)
# Download deployment metadata
# Note "mode = 'wb'! Needed to download the file in binary
download.file('https://members.oceantrack.org/data/repository/pbsm/data-and-metadata/2018/pbsm-instrument-deployment-short-form-2018.xls',
destfile = file.path(td, 'pbsm-instrument-deployment-short-form-2018.xls'),
mode = 'wb')
# Download qualified detections
download.file('https://members.oceantrack.org/data/repository/pbsm/detection-extracts/pbsm_qualified_detections_2018.zip',
destfile = file.path(td, 'pbsm_qualified_detections_2018.zip'))
# Download unqualified detections
download.file('https://members.oceantrack.org/data/repository/pbsm/detection-extracts/pbsm_unqualified_detections_2018.zip',
destfile = file.path(td, 'pbsm_unqualified_detections_2018.zip'))
qualified_filepath <- file.path(td, 'pbsm_qualified_detections_2018.zip')
unqualified_filepath <- file.path(td, 'pbsm_unqualified_detections_2018.zip')
deployment_filepath <- file.path(td, 'pbsm-instrument-deployment-short-form-2018.xls')
When you have an ACT project, matos
automatically uses
the most-recent data push date as a reference point to let you know what
has changed since the last time you’ve received new data. It doesn’t
know this for other networks, but you can provide a date via the
since
argument.
make_receiver_push_summary(
qualified = qualified_filepath,
unqualified = unqualified_filepath,
deployment = deployment_filepath,
since = '2018-05-06'
)
There you go – you now have a report of detections picked up by your receiver array in your working directory!
make_tag_push_summary
The same process applies to summarize your deployed transmitters.
download.file('https://members.oceantrack.org/data/repository/pbsm/detection-extracts/pbsm_matched_detections_2018.zip',
destfile = file.path(td, 'pbsm_matched_detections_2018.zip'))
matched_filepath <- file.path(td, 'pbsm_matched_detections_2018.zip')
make_tag_push_summary(matched = matched_filepath,
since = '2018-05-01')
Suggestions
I am always open to suggestions on what could be added to change to make this more useful for you. Please open an issue on GitHub or email me with your thoughts.
Errors and how to fix them
Could not determine mime type for `~\Matcheddetections_layer.fgb'
Error: pandoc document conversion failed with error 63
This error is created by an old version of the mapview
package (pre-June 2021) and has to do with the package’s switch to
using a file
geodatabase to increase plotting performance. To fix this, you have
two options:
- Update
mapview
(suggested), or - Run
mapviewOptions(fgb = FALSE)
before attempting to runmake_receiver_push_summary
ormake_tag_push_summary
. Note that this will make the report build more slowly.
References
Trudel, Marc. “A Pilot Study to Investigate the Migration of Atlantic Salmon Post-Smolts and Their Interactions with Aquaculture in Passamaquoddy Bay, New Brunswick, Canada.” Ocean Tracking Network, 2018. https://members.oceantrack.org/project?ccode=PBSM.