knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.align = 'center', fig.width = 6, fig.height = 4 )
library(opcr)
Reading and processing the data is all done using opc_process()
. This does the following steps:
read_focal_opc()
convert_single_opc()
opc_flag()
opc_trim()
Here's a simple example of how to process the raw OPC data. Note that this requires the user to interactively select the downcast so does not actually run in this vignette.
opc = opc_process(ifile = 'data/raw/OPC033.D00')
The processed data is stored in what I refer to as an opc tibble
with the following fields:
scan
- the scan number, which increases with each data record
timer
- the timer count, which is sent every 0.5 seconds since the unit was powered on and resets after 4095 values
atten
- light attenuation
depth
- instrument depth in meters
flag
- quality control flag, with zero meaning good. See opc_flag()
for the other definitions
secs
- the number of seconds elapsed since the instrument was powered on
time
- the datetime since the unit was powered on
volume_filtered
- the volume of water that has passed through the OPC since the previous record, in cubic meters
esd
- a nested list of the particle sizes, in Equivalent Spherical Diameter (ESD; mm) detected during this data record
Here's an example:
opc
Data in this format is the cornerstone of this package; all computation and plotting requires this opc tibble
as input.
Several functions make it convenient to calculate common OPC data products.
opc_histogram(opc)
opc_abundance(opc)
This uses the equation from Suthers et al (2006) to covert size to biomass.
opc_biomass(opc)
opc_image(opc)
Here are some quick plots. These take an opc tibble
as input, derive the relevant variables using the functions above, then return a nice ggplot. Check the function documentation for more information.
opc_plot_depth(opc)
opc_plot_flags(opc)
opc_plot_attenuance(opc)
opc_plot_histogram(opc)
opc_plot_abundance(opc)
opc_plot_biomass(opc)
opc_plot_image(opc)
opc_plot_multipanel(opc)
opc_plot_diagnostics(opc)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.