Title: | Processing and Visualization of Video Plankton Recorder Data |
---|---|
Description: | An oceanographic data processing package for analyzing and visualizing Video Plankton Recorder data. This package was developed at 'Bedford Institute of Oceanography'. Functions are designed to process automated image classification output and create organized and easily portable data products. |
Authors: | Emily O'Grady [aut, cre], Kevin Sorochan [aut], Catherine Johnson [aut] |
Maintainer: | Emily O'Grady <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.3.0 |
Built: | 2025-03-07 06:37:06 UTC |
Source: | https://github.com/eogrady21/vprr |
Bins CTD data for an individual cast to avoid depth averaging across tow-yo's
bin_calculate(data, binSize = 1, imageVolume, rev = FALSE)
bin_calculate(data, binSize = 1, imageVolume, rev = FALSE)
data |
ctd data frame object |
binSize |
the height of bins over which to average, default is 1 metre |
imageVolume |
the volume of VPR images used for calculating concentrations (mm^3) |
rev |
logical value, if TRUE, binning will begin at bottom of each cast, this controls data loss due to uneven binning over depth. If bins begin at bottom, small amounts of data may be lost at the surface of each cast, if binning begins at surface (rev = FALSE), small amounts of data may be lost at bottom of each cast |
Image volume calculations can change based on optical setting of VPR as well as autodeck setting used to process images.
For IML2018051 (S2) image volume was calculated as 108155 mm^3 by seascan (6.6 cubic inches).
For COR2019002 S2 image volume was calculated as 83663 mm^3 and S3 image volume was calculated as 366082 mm^3.
Used internally (bin_cast
) after ctd_cast
on a single ascending or descending section of VPR cast.
binSize should be carefully considered for best results.
Depth is used for calculations! Please ensure depth is included in data frame using swDepth.
E. Chisholm, K. Sorochan
Formats oce
style VPR data into depth averaged bins using ctd_cast
and bin_calculate
This function is used inside concentration_category
bin_cast( ctd_roi_oce, imageVolume, binSize, rev = FALSE, breaks = NULL, cutoff = 0.1 )
bin_cast( ctd_roi_oce, imageVolume, binSize, rev = FALSE, breaks = NULL, cutoff = 0.1 )
ctd_roi_oce |
|
imageVolume |
the volume of VPR images used for calculating concentrations (mm^3) |
binSize |
passed to |
rev |
logical value,passed to |
breaks |
Argument passed to ctdFindProfiles |
cutoff |
Argument passed to ctdFindProfiles |
Image volume calculations can change based on optical setting of VPR as well as autodeck setting used to process images For IML2018051 (S2) image volume was calculated as 108155 mm^3 by seascan (6.6 cubic inches) For COR2019002 S2 image volume was calculated as 83663 mm^3 and S3 image volume was calculated as 366082 mm^3
A dataframe of depth averaged bins of VPR data over an entire cast with calculated concentration values
A 'binned' dataframe from sample VPR data, including concentrations
of each category, where each data point represents a 5 metre bin of
averaged VPR data. Produced using vpr_roi_concentration
category_conc_n
category_conc_n
A dataframe with 21 variables
Depth calculated from pressure in metres
The minimum depth of the bin in metres
The maximum depth of the bin in metres
The difference between minimum and maximum bin depth in metres
The minimum time in seconds of the bin
The maximum time in seconds of the bin
The difference between minimum and maximum time in a bin, in seconds
The number of ROI observations in a bin
The concentration of ROIs in a bin, calculated based on image volume and number of frames per bin
Temperature measured from the VPR CTD in celsius (averaged within the bin)
Salinity measured from the VPR CTD (averaged within the bin)
sigma T density calculated from temperature, salinity and pressure (averaged within the bin)
Fluorescence measured by the VPR CTD in millivolts (uncalibrated) (averaged within the bin)
Turbidity measured by the VPR CTD in millivolts (uncalibrated) (averaged within the bin)
The mean time in which bin data was collected, in hours
The number of frames captured within a bin
The volume of the bin sampled in metres cubed
Identifier of the tow-yo section which bin is a part of, either ascending or descending, appended by a number
The maximum depth of the entire VPR cast
The category in which ROIs in bin have been classified by Visual Plankton
Station identifier provided during processing
This function produces depth binned concentrations for a specified category. Similar to bin_cast
but calculates concentrations for only one category.
Used inside vpr_roi_concentration
concentration_category( data, category, binSize, imageVolume, rev = FALSE, breaks = NULL, cutoff = 0.1 )
concentration_category( data, category, binSize, imageVolume, rev = FALSE, breaks = NULL, cutoff = 0.1 )
data |
dataframe produced by processing internal to vpr_roi_concentration |
category |
name of category isolated |
binSize |
passed to |
imageVolume |
the volume of VPR images used for calculating concentrations (mm^3) |
rev |
Logical value defining direction of binning, FALSE - bins will be calculated from surface to bottom, TRUE- bins will be calculated bottom to surface |
breaks |
Argument passed to ctdFindProfiles |
cutoff |
Argument passed to ctdFindProfiles |
Image volume calculations can change based on optical setting of VPR as well as autodeck setting used to process images For IML2018051 (S2) image volume was calculated as 108155 mm^3 by seascan (6.6 cubic inches) For COR2019002 S2 image volume was calculated as 83663 mm^3 and S3 image volume was calculated as 366082 mm^3
E. Chisholm
This is an internal step required to bin data
ctd_cast( data, cast_direction = "ascending", data_type, cutoff = 0.1, breaks = NULL )
ctd_cast( data, cast_direction = "ascending", data_type, cutoff = 0.1, breaks = NULL )
data |
an |
cast_direction |
'ascending' or 'descending' depending on desired section |
data_type |
specify 'oce' or 'df' depending on class of desired output |
cutoff |
Argument passed to ctdFindProfiles |
breaks |
Argument passed to ctdFindProfiles |
Outputs either data frame or oce ctd object
ctdFindProfiles
arguments for minLength
and cutOff
were updated to
prevent losing data (EC 2019/07/23)
K Sorochan, E Chisholm
A dataframe including all CTD parameters from the VPR CTD,
produced by vpr_ctd_read
ctd_dat_combine
ctd_dat_combine
A dataframe with 15 variables
Time stamp when ROI was collected (milliseconds)
Conductivity collected by the VPR CTD
Pressure measured from the VPR CTD in decibars
Temperature measured from the VPR CTD in celsius
Salinity measured from the VPR CTD
A reference fluorescence baseline provided in millivolts by the VPR CTD for calibrating fluorescence_mv data
Fluorescence in millivolts from the VPR CTD (uncalibrated)
A reference turbidity baseline provided in millivolts for calibrating turbidity_mv
Turbidity in millivolts from the VPR CTD (uncalibrated)
Altitude data from the VPR CTD
Day on which VPR data was collected (from AutoDeck)
Hour during which VPR data was collected (from AutoDeck)
Station idnetifier provided during processing
Density caluclated from temperature, pressure and salinity data
Depth in metres caluclated form pressure
Internal use vpr_ctd_read
ctd_df_cols(x, col_list)
ctd_df_cols(x, col_list)
x |
full filename (ctd .dat file) |
col_list |
list of CTD data column names |
WARNING This is hard coded to accept a specific order of CTD data columns. The names and values in these columns can change based on the specific instrument and should be updated before processing data from a new VPR.
Text file format .dat file Outputs ctd dataframe with variables time_ms, conductivity, temperature, pressure, salinity
K. Sorochan, E. Chisholm
A dataframe representing CTD data which has been merged with tabulated
ROIs in each category, produced by vpr_ctdroi_merge
ctd_roi_merge
ctd_roi_merge
A dataframe with 28 variables
Time stamp when ROI was collected (milliseconds)
Conductivity collected by the VPR CTD
Pressure measured from the VPR CTD in decibars
Temperature measured from the VPR CTD in celsius
Salinity measured from the VPR CTD
A reference fluorescence baseline provided in millivolts by the VPR CTD for calibrating fluorescence_mv data
Fluorescence in millivolts from the VPR CTD (uncalibrated)
A reference turbidity baseline provided in millivolts for calibrating turbidity_mv
Turbidity in millivolts from the VPR CTD (uncalibrated)
Altitude data from the VPR CTD
Day on which VPR data was collected (from AutoDeck)
Hour during which VPR data was collected (from AutoDeck)
Station identifier provided during processing
Density caluclated from temperature, pressure and salinity data
Depth in metres caluclated form pressure
ROI identification number
For each category name (eg. bad_image_blurry, Calanus, krill), there is a line in the dataframe representing the number of ROIs identified in this category
Total number of ROIs in all categories for each CTD data point
An oce formatted CTD object with VPR CTD and ROI data from package example data set.
ctd_roi_oce
ctd_roi_oce
An oce package format, a 'CTD' object with VPR CTD and ROI data (1000 data rows)
INTERNAL USE ONLY quick data frame function from github to insert row inside dat frame
insertRow(existingDF, newrow, r)
insertRow(existingDF, newrow, r)
existingDF |
data frame |
newrow |
new row of data |
r |
index of new row |
Get vector to draw isopycnal lines on TS plot Used internally to create TS plots
isopycnal_calculate(sal, pot.temp, reference.p = 0)
isopycnal_calculate(sal, pot.temp, reference.p = 0)
sal |
salinity vector |
pot.temp |
temperature vector in deg C |
reference.p |
reference pressure for calculation, set to 0 |
: modified from source:https://github.com/Davidatlarge/ggTS/blob/master/ggTS_DK.R
E. Chisholm
take each element of matrix dived by column total
normalize_matrix(mat)
normalize_matrix(mat)
mat |
a matrix to normalize |
Make sure to remove total rows before using with VP data
used internally for visualization of confusion matrices
Used internally
px_to_mm(x, opticalSetting)
px_to_mm(x, opticalSetting)
x |
an aidmea data frame (standard) to be converted into mm from pixels |
opticalSetting |
the VPR setting determining the field of view and conversion factor between mm and pixels |
converts pixels to mm using conversion factor specific to optical setting
Options for opticalSetting are 'S0', 'S1', 'S2', or 'S3'
Read aid files produced by automated classification
read_aid_cnn(aid_file)
read_aid_cnn(aid_file)
aid_file |
a file path to an aid file produced by automated classification (with ROI path and probability value) |
ROI path and probability values in a table
A dataframe including VPR ROI data from the sample dataset, produced by
vpr_autoid_read
roi_dat_combine
roi_dat_combine
A dataframe with 13 variables
Unique ROI identifier - 8 digit
For each category name (eg. bad_image_blurry, Calanus, krill), there is a line in the dataframe representing the number of ROIs identified in this category
Time stamp when ROI was collected (milliseconds)
A data frame of measurement information for each ROI in the sample
data set including long axis length, perimeter and area, produced by
vpr_autoid_read
roimeas_dat_combine
roimeas_dat_combine
A data frame with 12 variables
Unique ROI identifier - 10 digit
Category in which ROI has been classified
day and hour in which data was collected (from Autodeck)
The perimeter of the ROI in millimeters
The area of the ROI in millimeters
Width at a first point of the ROI in millimetres (defined in more detail in VPR manual)
Width at a second point of the ROI in millimetres (defined in more detail in VPR manual)
Width at a third point of the ROI in millimetres (defined in more detail in VPR manual)
The length in millimeters of the ROI along the shorter axis
The length in millimeters of the ROI along the longer axis
Station identifier provided in processing
Time stamp when ROI was collected in milliseconds
A sample data frame of size information from Visual Plankton outputs,
processed using vpr_ctdroisize_merge
size_df_f
size_df_f
An object of class data.frame
with 14 rows and 14 columns.
@format A dataframe with 14 variables including
Unique identifier for each VPR frame
Pressure measured from the VPR CTD in decibars
Temperature measured from the VPR CTD in celsius
Salinity measured from the VPR CTD
Density calculated from temperature, salinity and pressure
Fluorescence measured by the VPR CTD in millivolts (uncalibrated)
Turbidity measured by the VPR CTD in millivolts (uncalibrated)
Unique ROI identification number - 10 digits, 8 digit millisecond time stamp and two unique digits to denote multiple ROIs within a millisecond
Category in which ROI has been classified by Visual Plankton
Day and hour in which data was collected, from AutoDeck processing
The length of the longest axis of the ROI image, measured by Visual Plankton
Station identifier provided during processing
Time stamp when ROI was collected (milliseconds)
ROI identification number- 8 digit time stamp, without unique 2 digit ending
Checks for empty files, with an option to delete them. Then checks all the
data for duplicated or missing ROIs which would indicate a problem with
vpr_autoid_create()
vpr_autoid_check(new_autoid, original_autoid, cruise, dayhours)
vpr_autoid_check(new_autoid, original_autoid, cruise, dayhours)
new_autoid |
file path to autoid folder eg. C:/data/CRUISENAME/autoid/ (produced by |
original_autoid |
file path to original autoid folder (produced by automated classification) |
cruise |
name of cruise which is being checked |
dayhours |
chr vector, of unique day and hour values to check through (format d123.h12) |
text file (saved in working directory) named CRUISENAME_aid_file_check.txt
E Chisholm
Organize VPR images into folders based on classifications provided by visual plankton
vpr_autoid_copy( new_autoid, roi_path, day, hour, threshold = NULL, org = "dayhour", cast = NULL, station = NULL )
vpr_autoid_copy( new_autoid, roi_path, day, hour, threshold = NULL, org = "dayhour", cast = NULL, station = NULL )
new_autoid |
A file path to your autoid folder where data is stored eg. "C:/data/cruise_X/autoid/" |
roi_path |
(optional) provide if ROI data has been moved since autoid files were created (if path strings in aid files do not match where data currently exists), a file path where ROI data is stored (up to "rois" folder) |
day |
character string representing numeric day of interest (3 chr) |
hour |
character string representing hour of interest (2 chr) |
threshold |
(optional) a numeric value, supplied only if you are copying images based on automated classifications, only images below this threshold of confidence will be copied for manual classification. Default is set to NULL. |
org |
chr value, if 'station', images will be output in folders labelled by station, if 'dayhour', images will be output in folders labelled by day and hour |
cast |
(optional) character string, VPR cast number of interest (3 chr), required if org is 'station' |
station |
(optional) character string, station name of interest (eg. "Shediac"), required if org is 'station' |
organized file directory where VPR images are contained with folders, organized by day, hour and classification, inside your autoid folder
this function uses tidy paths, see fs::path_tidy() for more info
Modifies aid and aid mea files based on manual reclassification
vpr_autoid_create( reclassify, misclassified, basepath, day, hour, mea = TRUE, categories )
vpr_autoid_create( reclassify, misclassified, basepath, day, hour, mea = TRUE, categories )
reclassify |
list of reclassify files (output from vpr_manual_classification()) |
misclassified |
list misclassify files (output from vpr_manual_classification()) |
basepath |
path to folder containing autoid files (e.g., 'extdata/COR2019002/autoid') |
day |
day identifier for relevant aid & aidmeas files |
hour |
hour identifier for relevant aid & aidmeas files |
mea |
logical indicating whether or not there are accompanying measurement files to be created |
categories |
A list object with all the potential classification categories |
E. Chisholm
## Not run: basepath <- 'E:/autoID_EC_07032019/' day <- '289' hr <- '08' categories <- c("bad_image_blurry", "bad_image_malfunction", "bad_image_strobe", "Calanus", "chaetognaths", "ctenophores", "krill", "marine_snow", "Other", "small_copepod", "stick") day_hour_files <- paste0('d', day, '.h', hr) misclassified <- list.files(day_hour_files, pattern = 'misclassified_', full.names = TRUE) reclassify <- list.files(day_hour_files, pattern = 'reclassify_', full.names = TRUE) vpr_autoid_create(reclassify, misclassified, basepath, categories) ## End(Not run)
## Not run: basepath <- 'E:/autoID_EC_07032019/' day <- '289' hr <- '08' categories <- c("bad_image_blurry", "bad_image_malfunction", "bad_image_strobe", "Calanus", "chaetognaths", "ctenophores", "krill", "marine_snow", "Other", "small_copepod", "stick") day_hour_files <- paste0('d', day, '.h', hr) misclassified <- list.files(day_hour_files, pattern = 'misclassified_', full.names = TRUE) reclassify <- list.files(day_hour_files, pattern = 'reclassify_', full.names = TRUE) vpr_autoid_create(reclassify, misclassified, basepath, categories) ## End(Not run)
Read aid text files containing ROI string information or measurement data and output as a dataframe
vpr_autoid_read( file_list_aid, file_list_aidmeas, export, station_of_interest, opticalSetting, warn = TRUE, categories )
vpr_autoid_read( file_list_aid, file_list_aidmeas, export, station_of_interest, opticalSetting, warn = TRUE, categories )
file_list_aid |
a list object of aid text files, containing ROI strings. |
file_list_aidmeas |
a list object of aidmea text files, containing ROI measurements. |
export |
a character string specifying which type of data to output, either 'aid' (roi strings) or 'aidmeas' (measurement data) |
station_of_interest |
Station information to be added to ROI data output, use NA if irrelevant |
opticalSetting |
Optional argument specifying VPR optical setting. If provided will be used to convert size data into mm from pixels, if missing size data will be output in pixels |
warn |
Logical, FALSE silences size data unit warnings |
categories |
A list object (of chr strings) with all the potential classification categories |
Only outputs either ROI string information OR measurement data
Full paths to each file should be specified
E. Chisholm & K. Sorochan
station_of_interest <- 'test' dayhour <- c('d222.h03', 'd222.h04') categories <- c("bad_image_blurry", "bad_image_malfunction", "bad_image_strobe", "Calanus", "chaetognaths","ctenophores","krill", "marine_snow","Other","small_copepod", "stick") #' #VPR OPTICAL SETTING (S0, S1, S2 OR S3) opticalSetting <- "S2" imageVolume <- 83663 #mm^3 auto_id_folder <- system.file('extdata/COR2019002/autoid/', package = 'vprr', mustWork = TRUE) auto_id_path <- list.files(paste0(auto_id_folder, "/"), full.names = TRUE) #' # Path to aid for each category aid_path <- paste0(auto_id_path, '/aid/') # Path to mea for each category aidmea_path <- paste0(auto_id_path, '/aidmea/') # AUTO ID FILES aid_file_list <- list() aidmea_file_list <- list() for (i in 1:length(dayhour)) { aid_file_list[[i]] <- list.files(aid_path, pattern = dayhour[[i]], full.names = TRUE) # SIZE DATA FILES aidmea_file_list[[i]] <- list.files(aidmea_path, pattern = dayhour[[i]], full.names = TRUE) } aid_file_list_all <- unlist(aid_file_list) aidmea_file_list_all <- unlist(aidmea_file_list) # ROIs roi_dat_combine <- vpr_autoid_read( file_list_aid = aid_file_list_all, file_list_aidmeas = aidmea_file_list_all, export = 'aid', station_of_interest = station_of_interest, opticalSetting = opticalSetting, warn = FALSE, categories = categories ) # MEASUREMENTS roimeas_dat_combine <- vpr_autoid_read( file_list_aid = aid_file_list_all, file_list_aidmeas = aidmea_file_list_all, export = 'aidmeas', station_of_interest = station_of_interest, opticalSetting = opticalSetting, warn = FALSE, categories = categories )
station_of_interest <- 'test' dayhour <- c('d222.h03', 'd222.h04') categories <- c("bad_image_blurry", "bad_image_malfunction", "bad_image_strobe", "Calanus", "chaetognaths","ctenophores","krill", "marine_snow","Other","small_copepod", "stick") #' #VPR OPTICAL SETTING (S0, S1, S2 OR S3) opticalSetting <- "S2" imageVolume <- 83663 #mm^3 auto_id_folder <- system.file('extdata/COR2019002/autoid/', package = 'vprr', mustWork = TRUE) auto_id_path <- list.files(paste0(auto_id_folder, "/"), full.names = TRUE) #' # Path to aid for each category aid_path <- paste0(auto_id_path, '/aid/') # Path to mea for each category aidmea_path <- paste0(auto_id_path, '/aidmea/') # AUTO ID FILES aid_file_list <- list() aidmea_file_list <- list() for (i in 1:length(dayhour)) { aid_file_list[[i]] <- list.files(aid_path, pattern = dayhour[[i]], full.names = TRUE) # SIZE DATA FILES aidmea_file_list[[i]] <- list.files(aidmea_path, pattern = dayhour[[i]], full.names = TRUE) } aid_file_list_all <- unlist(aid_file_list) aidmea_file_list_all <- unlist(aidmea_file_list) # ROIs roi_dat_combine <- vpr_autoid_read( file_list_aid = aid_file_list_all, file_list_aidmeas = aidmea_file_list_all, export = 'aid', station_of_interest = station_of_interest, opticalSetting = opticalSetting, warn = FALSE, categories = categories ) # MEASUREMENTS roimeas_dat_combine <- vpr_autoid_read( file_list_aid = aid_file_list_all, file_list_aidmeas = aidmea_file_list_all, export = 'aidmeas', station_of_interest = station_of_interest, opticalSetting = opticalSetting, warn = FALSE, categories = categories )
Get category ids from string
vpr_category(x, categories)
vpr_category(x, categories)
x |
A chr string which represents file paths from which category should be extracted |
categories |
A list object with all the potential classification categories |
A chr string of only the category id
This function searches for exact matches to categories within '/' file separators. You may encounter errors if
K Sorochan
category_string <- 'C:/data/cruise/autoid/Calanus/d000/h00' categories <- list("Calanus", "marine_snow", "blurry", "other_copepod") vpr_category(category_string, categories)
category_string <- 'C:/data/cruise/autoid/Calanus/d000/h00' categories <- list("Calanus", "marine_snow", "blurry", "other_copepod") vpr_category(category_string, categories)
creates empty directory structure to allow consideration of new category during vpr_manual_classification()
vpr_category_create(category, basepath)
vpr_category_create(category, basepath)
category |
new category name to be added (can be a list of multiple category names) |
basepath |
path to folder containing autoid files (e.g., 'extdata/COR2019002/autoid') |
empty directory structure using new category name inside basepath
Searches through typical VP directory structure
vpr_ctd_files(castdir, cruise, day_hour)
vpr_ctd_files(castdir, cruise, day_hour)
castdir |
root directory for ctd cast files |
cruise |
cruise name (exactly as in directory structure) |
day_hour |
vector of day-hour combinations (e.g, dXXX.hXX) |
Use with caution
vector of ctd file paths matching days-hour combinations provided
E. Chisholm and K. Sorochan
Acts as a wrapper for ctd_df_cols
vpr_ctd_read(ctd_files, station_of_interest, day, hour, col_list)
vpr_ctd_read(ctd_files, station_of_interest, day, hour, col_list)
ctd_files |
full file paths to vpr ctd |
station_of_interest |
VPR station name |
day |
Day of interest, if not provided will be pulled from file path |
hour |
Hour of interest, if not provided will be pulled from file path |
col_list |
Optional chr vector of CTD data column names |
Reads CTD data and adds day, hour, and station information. Calculates sigma T and depth variables from existing CTD data to supplement raw data. If there are multiple hours of CTD data, combines them into single dataframe.
WARNING ctd_df_cols
is hard coded to accept a specific
order of CTD data columns. The names and values in these columns can change
based on the specific instrument and should be updated/confirmed before processing data
from a new VPR.
E. Chisholm & K. Sorochan
station_of_interest <- 'test' ctd_files <- system.file("extdata/COR2019002/rois/vpr5/d222", "h03ctd.dat.gz", package = "vprr", mustWork = TRUE) ctd_dat_combine <- vpr_ctd_read(ctd_files, station_of_interest)
station_of_interest <- 'test' ctd_files <- system.file("extdata/COR2019002/rois/vpr5/d222", "h03ctd.dat.gz", package = "vprr", mustWork = TRUE) ctd_dat_combine <- vpr_ctd_read(ctd_files, station_of_interest)
Obtain columns for date and time (i.e., column "ymdhms") and time in hours (i.e., column time_hr) for each row in VPR data frame by utilizing day-of-year, hour, and millisecond outputs from VPR data output.
vpr_ctd_ymd(data, year, offset)
vpr_ctd_ymd(data, year, offset)
data |
VPR data frame from |
year |
Year of data collection |
offset |
time offset in hours between VPR CPU and processed data times (optional) |
A VPR data frame with columns for date and time (i.e., column 'ymdhms') and hour (i.e., column time_hr)
year <- 2019 data('ctd_roi_merge') dat <- vpr_ctd_ymd(ctd_roi_merge, year)
year <- 2019 data('ctd_roi_merge') dat <- vpr_ctd_ymd(ctd_roi_merge, year)
Combines CTD data (time, hydrographic parameters), with ROI information (identification number) into single dataframe, aligning ROI identification numbers and category classifications with time and hydrographic parameters
vpr_ctdroi_merge(ctd_dat_combine, roi_dat_combine)
vpr_ctdroi_merge(ctd_dat_combine, roi_dat_combine)
ctd_dat_combine |
a CTD dataframe from VPR processing from |
roi_dat_combine |
a data frame of roi aid data from |
E. Chisholm & K. Sorochan
data('ctd_dat_combine') data('roi_dat_combine') ctd_roi_merge <- vpr_ctdroi_merge(ctd_dat_combine, roi_dat_combine)
data('ctd_dat_combine') data('roi_dat_combine') ctd_roi_merge <- vpr_ctdroi_merge(ctd_dat_combine, roi_dat_combine)
Format CTD and Meas data frames into combined data frame for analysis and plotting of size data
vpr_ctdroisize_merge(data, data_mea, category_of_interest)
vpr_ctdroisize_merge(data, data_mea, category_of_interest)
data |
VPR dataframe from |
data_mea |
VPR size data frame from |
category_of_interest |
a list of category of interest to be included in output dataframe |
A dataframe containing VPR CTD and size data
## Not run: data("ctd_roi_merge") data("roimeas_dat_combine") category_of_interest = 'Calanus' ctd_roi_merge$time_hr <- ctd_roi_merge$time_ms /3.6e+06 size_df_f <- vpr_ctdroisize_merge(ctd_roi_merge, data_mea = roimeas_dat_combine, category_of_interest = category_of_interest) ## End(Not run)
## Not run: data("ctd_roi_merge") data("roimeas_dat_combine") category_of_interest = 'Calanus' ctd_roi_merge$time_hr <- ctd_roi_merge$time_ms /3.6e+06 size_df_f <- vpr_ctdroisize_merge(ctd_roi_merge, data_mea = roimeas_dat_combine, category_of_interest = category_of_interest) ## End(Not run)
Get day identifier
vpr_day(x)
vpr_day(x)
x |
A string specifying the directory and file name of the size file |
A string of only the day identifier (i.e., "dXXX")
K Sorochan
vpr_hour
, vpr_roi
, vpr_category
day_string <- 'C:/data/cruise/autoid/Calanus/d000/h00' vpr_day(day_string)
day_string <- 'C:/data/cruise/autoid/Calanus/d000/h00' vpr_day(day_string)
@author E. Chisholm and K. Sorochan
vpr_dayhour(stations, file)
vpr_dayhour(stations, file)
stations |
a vector of character values naming stations of interest |
file |
CSV file containing 'day', 'hour', 'station', and 'day_hour' columns |
Vector of day-hour combinations corresponding to stations of interest
Format and export VPR data for publication (IN DEVELOPMENT) Exports a csv file with standard column names based on British Oceanographic Data Centre, BODC::P01 and DarwinCore (DwC) naming conventions, and a JSON metadata file for station level metadata
vpr_export(data, metadata, columnNames, file)
vpr_export(data, metadata, columnNames, file)
data |
a VPR data frame |
metadata |
(optional) a named list of character values giving metadata to be included in JSON file |
columnNames |
(optional) a named list of character values giving relationships between existing names of data columns and standard names |
file |
a file name for the data.csv |
## Not run: data(category_conc_n) metadata <- list( "station_level" = list( "title" = list("en" = "VPR data from the Scotian Shelf", "fr" = "Données VPR de l'étagère néo-écossaise"), "dataset_ID" = 1, "decimalLatitudeStart" = 44.5, "decimalLongitudeStart" = -64.5, "decimalLatitudeEnd" = 45.5, "decimalLongitudeEnd" = -65.5, "maximumDepthInMeters" = 1000, "eventDate" = "2019-08-11", "eventTime" = "00:00:00", "basisOfRecord" = "MachineObservation", "associatedMedia" = "https://ecotaxa.obs-vlfr.fr/ipt/archive.do?r=iml2018051", "identificationReferences" = "Iv3 model v3.3", "instrument" = list("opticalSetting" = "S2", "imageVolume" = 83663), "resources" = list( "data" = list("name" = "vpr123_station25.csv", "creationDate" = "2023-01-01"), "metadata" = list("name" = "vpr123_station25-metadata.json", "creationDate" = "2023-01-01") ), "dataAttributes" = list( "eventID" = list( "dataType" = "chr", "definition" = "An identifier for the set of information associated with a dwc:Event (something that occurs at a place and time). May be a global unique identifier or an identifier specific to the data set.", "vocabulary" = "dwc" ), "minimumDepthInMeters" = list( "dataType" = "float", "definition" = "The lesser depth of a range of depth below the local", "vocabulary" = "dwc" ), "maximumDepthInMeters" = list( "dataType" = "float", "definition" = "The greater depth of a range of depth below the local", "vocabulary" = "dwc" ), "DEPHPRST" = list( "dataType" = "float", "definition" = "Depth (spatial coordinate) of sampling event start relative to water surface in the water body by profiling pressure sensor and conversion to depth using unspecified algorithm", "vocabulary" = "BODC::P01" ), "individualCount" = list( "dataType" = "float", "definition" = "The number of individuals present at the time of the dwc:Occurrence.", "vocabulary" = "dwc" ), "verbatimIdentification" = list( "dataType" = "chr", "definition" = "A string representing the taxonomic identification as it appeared in the original record.", "vocabulary" = "dwc" ), "SDBIOL01" = list( "dataType" = "float", "definition" = "Abundance of biological entity specified elsewhere per unit volume of the water body", "vocabulary" = "BODC::P01" ), "TEMPST01" = list( "dataType" = "float", "definition" = "Temperature of the water body by CTD or STD", "vocabulary" = "BODC::P01" ), "PSALST01" = list( "dataType" = "float", "definition" = "Practical salinity of the water body by CTD and computation using UNESCO 1983 algorithm", "vocabulary" = "BODC::P01" ), "POTDENS0" = list( "dataType" = "float", "definition" = "Density (potential) of the water body by computation from salinity and potential temperature using UNESCO algorithm with 0 decibar reference pressure", "vocabulary" = "BODC::P01" ), "FLUOZZZZ" = list( "dataType" = "float", "definition" = "Fluorescence of the water body", "vocabulary" = "BODC::P01" ), "TURBXXXX" = list( "dataType" = "float", "definition" = "Turbidity of water in the water body", "vocabulary" = "BODC::P01" ), "sampleSizeValue" = list( "dataType" = "float", "definition" = "A numeric value for a measurement of the size (time duration, length, area, or volume) of a sample in a sampling dwc:Event.", "vocabulary" = "dwc" ), "sampleSizeUnit" = list( "dataType" = "chr", "definition" = "The unit of measurement of the size (time duration, length, area, or volume) of a sample in a sampling dwc:Event.", "vocabulary" = "dwc" ), "scientificName" = list( "dataType" = "chr", "definition" = "The full scientific name, with authorship and date information if known. When forming part of a dwc:Identification, this should be the name in lowest level taxonomic rank that can be determined. This term should not contain identification qualifications, which should instead be supplied in the dwc:identificationQualifier term.", "vocabulary" = "dwc" ), "identifiedBy" = list( "dataType" = "chr", "definition" = "A list (concatenated and separated) of names of people, groups, or organisations who assigned the Taxon to the subject.", "vocabulary" = "dwc" ), "identificationVerificationStatus" = list( "dataType" = "chr", "definition" = "A categorical indicator of the extent to which the taxonomic identification has been verified to be correct.", "vocabulary" = "dwc" ), "depthDifferenceMeters" = list( "dataType" = "float", "definition" = "Difference between maximumDepthInMeters and minimumDepthInMeters of an individual data bin, in meters", "vocabulary" = "BIO" ), "minimumTimeSeconds" = list( "dataType" = "float", "definition" = "minimum time value in a data bin, measured in seconds from the start of the day of sampling", "vocabulary" = "BIO" ), "maximumTimeSeconds" = list( "dataType" = "float", "definition" = "maximum time value in a data bin, measured in seconds from the start of the day of sampling", "vocabulary" = "BIO" ), "timeDifferenceSeconds" = list( "dataType" = "float", "definition" = "Difference between maximumTimeSeconds and minimumTimeSeconds of an individual data bin, in seconds", "vocabulary" = "BIO" ), "numberOfFrames" = list( "dataType" = "float", "definition" = "number of VPR frames captured within an individual data bin", "vocabulary" = "BIO" ), "timeMilliseconds" = list( "dataType" = "float", "definition" = "Time measured in milliseconds since the start of the sampling day", "vocabulary" = "BIO" ), "towyoID" = list( "dataType" = "chr", "definition" = "A string identifying the section of the cast to which the data point belongs", "vocabulary" = "BIO" ), "maximumCastDepthInMeters" = list( "dataType" = "float", "definition" = "Maximum depth in Meters of the cast dataset", "vocabulary" = "BIO" ) ) ) ) # new_name = old_name columnNames = list( "DEPHPRST" = "depth" , "verbatimIdentification" = "category", "eventID" = "station", "minimumDepthInMeters" = "min_depth", "maximumDepthInMeters" = "max_depth", "individualCount" = "n_roi_bin", "SDBIOL01" = "conc_m3", "TEMPST01" = "temperature", "PSALST01" = "salinity", "POTDENS0" = "density", "FLUOZZZZ" = "fluorescence", "TURBXXXX" = "turbidity", "sampleSizeValue" = "vol_sampled_bin_m3", "depthDifferenceMeters" = "depth_diff", "minimumTimeSeconds" = "min_time_s", "maximumTimeSeconds" = "max_time_s", "timeDifferenceSeconds" = "time_diff_s", "numberOfFrames" = "n_frames", "timeMilliseconds" = "time_ms", "towyoID" = "towyo", "maximumCastDepthInMeters" = "max_cast_depth" ) # add any new data columns required # (eg. sampleSizeUnit, scientificName, identifiedBy, identificationVerificationStatus) sampleSizeUnit <- "cubic metre" identifiedBy <- "K. Sorochan" identificationVerificationStatus <- "ValidatedByHuman" data <- category_conc_n %>% mutate(., identifiedBy = identifiedBy, sampleSizeUnit = sampleSizeUnit, identificationVerificationStatus = identificationVerificationStatus) # Define the mapping between category and scientific name # scientific names based ecotaxa taxonomic system scientificName <- list("blurry" = "bad_image_blurry", "artefact" = c("bad_image_malfunction", "bad_image_strobe"), "Calanus" = "Calanus") # Create a new column of data called scientificName based on matches to category data <- data %>% dplyr::mutate(., scientificName = case_when( category %in% scientificName[["blurry"]] ~ "blurry", category %in% scientificName[["artefact"]] ~ "artefact", category == scientificName[["Calanus"]] ~ "Calanus", TRUE ~ NA )) vpr_export(data, metadata, columnNames, file = "vpr123_station25") ## End(Not run)
## Not run: data(category_conc_n) metadata <- list( "station_level" = list( "title" = list("en" = "VPR data from the Scotian Shelf", "fr" = "Données VPR de l'étagère néo-écossaise"), "dataset_ID" = 1, "decimalLatitudeStart" = 44.5, "decimalLongitudeStart" = -64.5, "decimalLatitudeEnd" = 45.5, "decimalLongitudeEnd" = -65.5, "maximumDepthInMeters" = 1000, "eventDate" = "2019-08-11", "eventTime" = "00:00:00", "basisOfRecord" = "MachineObservation", "associatedMedia" = "https://ecotaxa.obs-vlfr.fr/ipt/archive.do?r=iml2018051", "identificationReferences" = "Iv3 model v3.3", "instrument" = list("opticalSetting" = "S2", "imageVolume" = 83663), "resources" = list( "data" = list("name" = "vpr123_station25.csv", "creationDate" = "2023-01-01"), "metadata" = list("name" = "vpr123_station25-metadata.json", "creationDate" = "2023-01-01") ), "dataAttributes" = list( "eventID" = list( "dataType" = "chr", "definition" = "An identifier for the set of information associated with a dwc:Event (something that occurs at a place and time). May be a global unique identifier or an identifier specific to the data set.", "vocabulary" = "dwc" ), "minimumDepthInMeters" = list( "dataType" = "float", "definition" = "The lesser depth of a range of depth below the local", "vocabulary" = "dwc" ), "maximumDepthInMeters" = list( "dataType" = "float", "definition" = "The greater depth of a range of depth below the local", "vocabulary" = "dwc" ), "DEPHPRST" = list( "dataType" = "float", "definition" = "Depth (spatial coordinate) of sampling event start relative to water surface in the water body by profiling pressure sensor and conversion to depth using unspecified algorithm", "vocabulary" = "BODC::P01" ), "individualCount" = list( "dataType" = "float", "definition" = "The number of individuals present at the time of the dwc:Occurrence.", "vocabulary" = "dwc" ), "verbatimIdentification" = list( "dataType" = "chr", "definition" = "A string representing the taxonomic identification as it appeared in the original record.", "vocabulary" = "dwc" ), "SDBIOL01" = list( "dataType" = "float", "definition" = "Abundance of biological entity specified elsewhere per unit volume of the water body", "vocabulary" = "BODC::P01" ), "TEMPST01" = list( "dataType" = "float", "definition" = "Temperature of the water body by CTD or STD", "vocabulary" = "BODC::P01" ), "PSALST01" = list( "dataType" = "float", "definition" = "Practical salinity of the water body by CTD and computation using UNESCO 1983 algorithm", "vocabulary" = "BODC::P01" ), "POTDENS0" = list( "dataType" = "float", "definition" = "Density (potential) of the water body by computation from salinity and potential temperature using UNESCO algorithm with 0 decibar reference pressure", "vocabulary" = "BODC::P01" ), "FLUOZZZZ" = list( "dataType" = "float", "definition" = "Fluorescence of the water body", "vocabulary" = "BODC::P01" ), "TURBXXXX" = list( "dataType" = "float", "definition" = "Turbidity of water in the water body", "vocabulary" = "BODC::P01" ), "sampleSizeValue" = list( "dataType" = "float", "definition" = "A numeric value for a measurement of the size (time duration, length, area, or volume) of a sample in a sampling dwc:Event.", "vocabulary" = "dwc" ), "sampleSizeUnit" = list( "dataType" = "chr", "definition" = "The unit of measurement of the size (time duration, length, area, or volume) of a sample in a sampling dwc:Event.", "vocabulary" = "dwc" ), "scientificName" = list( "dataType" = "chr", "definition" = "The full scientific name, with authorship and date information if known. When forming part of a dwc:Identification, this should be the name in lowest level taxonomic rank that can be determined. This term should not contain identification qualifications, which should instead be supplied in the dwc:identificationQualifier term.", "vocabulary" = "dwc" ), "identifiedBy" = list( "dataType" = "chr", "definition" = "A list (concatenated and separated) of names of people, groups, or organisations who assigned the Taxon to the subject.", "vocabulary" = "dwc" ), "identificationVerificationStatus" = list( "dataType" = "chr", "definition" = "A categorical indicator of the extent to which the taxonomic identification has been verified to be correct.", "vocabulary" = "dwc" ), "depthDifferenceMeters" = list( "dataType" = "float", "definition" = "Difference between maximumDepthInMeters and minimumDepthInMeters of an individual data bin, in meters", "vocabulary" = "BIO" ), "minimumTimeSeconds" = list( "dataType" = "float", "definition" = "minimum time value in a data bin, measured in seconds from the start of the day of sampling", "vocabulary" = "BIO" ), "maximumTimeSeconds" = list( "dataType" = "float", "definition" = "maximum time value in a data bin, measured in seconds from the start of the day of sampling", "vocabulary" = "BIO" ), "timeDifferenceSeconds" = list( "dataType" = "float", "definition" = "Difference between maximumTimeSeconds and minimumTimeSeconds of an individual data bin, in seconds", "vocabulary" = "BIO" ), "numberOfFrames" = list( "dataType" = "float", "definition" = "number of VPR frames captured within an individual data bin", "vocabulary" = "BIO" ), "timeMilliseconds" = list( "dataType" = "float", "definition" = "Time measured in milliseconds since the start of the sampling day", "vocabulary" = "BIO" ), "towyoID" = list( "dataType" = "chr", "definition" = "A string identifying the section of the cast to which the data point belongs", "vocabulary" = "BIO" ), "maximumCastDepthInMeters" = list( "dataType" = "float", "definition" = "Maximum depth in Meters of the cast dataset", "vocabulary" = "BIO" ) ) ) ) # new_name = old_name columnNames = list( "DEPHPRST" = "depth" , "verbatimIdentification" = "category", "eventID" = "station", "minimumDepthInMeters" = "min_depth", "maximumDepthInMeters" = "max_depth", "individualCount" = "n_roi_bin", "SDBIOL01" = "conc_m3", "TEMPST01" = "temperature", "PSALST01" = "salinity", "POTDENS0" = "density", "FLUOZZZZ" = "fluorescence", "TURBXXXX" = "turbidity", "sampleSizeValue" = "vol_sampled_bin_m3", "depthDifferenceMeters" = "depth_diff", "minimumTimeSeconds" = "min_time_s", "maximumTimeSeconds" = "max_time_s", "timeDifferenceSeconds" = "time_diff_s", "numberOfFrames" = "n_frames", "timeMilliseconds" = "time_ms", "towyoID" = "towyo", "maximumCastDepthInMeters" = "max_cast_depth" ) # add any new data columns required # (eg. sampleSizeUnit, scientificName, identifiedBy, identificationVerificationStatus) sampleSizeUnit <- "cubic metre" identifiedBy <- "K. Sorochan" identificationVerificationStatus <- "ValidatedByHuman" data <- category_conc_n %>% mutate(., identifiedBy = identifiedBy, sampleSizeUnit = sampleSizeUnit, identificationVerificationStatus = identificationVerificationStatus) # Define the mapping between category and scientific name # scientific names based ecotaxa taxonomic system scientificName <- list("blurry" = "bad_image_blurry", "artefact" = c("bad_image_malfunction", "bad_image_strobe"), "Calanus" = "Calanus") # Create a new column of data called scientificName based on matches to category data <- data %>% dplyr::mutate(., scientificName = case_when( category %in% scientificName[["blurry"]] ~ "blurry", category %in% scientificName[["artefact"]] ~ "artefact", category == scientificName[["Calanus"]] ~ "Calanus", TRUE ~ NA )) vpr_export(data, metadata, columnNames, file = "vpr123_station25") ## End(Not run)
Get hour identifier
vpr_hour(x)
vpr_hour(x)
x |
A string specifying the directory and file name of the size file |
A string of only the hour identifier (i.e., "hXX")
K Sorochan
vpr_day
, vpr_roi
, vpr_category
hour_string <- 'C:/data/cruise/autoid/Calanus/d000/h00' vpr_hour(hour_string)
hour_string <- 'C:/data/cruise/autoid/Calanus/d000/h00' vpr_hour(hour_string)
Pulls images from specific depth ranges in specific classification group
vpr_img_category( data, min.depth, max.depth, roiFolder, format = "list", category_of_interest )
vpr_img_category( data, min.depth, max.depth, roiFolder, format = "list", category_of_interest )
data |
data frame containing CTD and ROI data from
|
min.depth |
minimum depth of ROIs you are interested in looking at |
max.depth |
maximum depth of ROIs you are interested in exploring |
roiFolder |
directory that ROIs are within (can be very general eg. C:/data, but will be quicker to process with more specific file path) |
format |
option of how images will be output, either as 'list' a list of file names or 'image' where images will be displayed |
category_of_interest |
character string of classification group from which to pull images |
Should be used after vpr_img_copy
, and manual image removal from created folders
vpr_img_check(folder_dir, basepath)
vpr_img_check(folder_dir, basepath)
folder_dir |
directory path to day hour folders containing manually reorganized images of a specific category eg. 'C:/data/cruise_IML2018051/krill/images/' where that folder contains '......d123.h01/' which contains manually sorted images of krill |
basepath |
directory path to original Visual Plankton files, specified down to the classification group. eg. 'C:/data/cruise_IML2018051/autoid/krill' |
This function can be used to copy images from a particular category, day and hour into distinct folders within the auto id directory This is useful for visualizing the ROIs of a particular classification group or for performing manual tertiary checks to remove images not matching classification group descriptions.
vpr_img_copy(auto_id_folder, categories.of.interest, day, hour)
vpr_img_copy(auto_id_folder, categories.of.interest, day, hour)
auto_id_folder |
eg "D:/VP_data/IML2018051/autoid" |
categories.of.interest |
eg. categories.of.interest <- c('Calanus') |
day |
character, day of interest |
hour |
character, hour of interest |
Allows user to pull VPR images from specific depth ranges, to investigate trends before classification of images into category groups
vpr_img_depth(data, min.depth, max.depth, roiFolder, format = "list")
vpr_img_depth(data, min.depth, max.depth, roiFolder, format = "list")
data |
data frame containing CTD and ROI data from
|
min.depth |
minimum depth of ROIs you are interested in looking at |
max.depth |
maximum depth of ROIs you are interested in exploring |
roiFolder |
directory that ROIs are within (can be very general eg. C:/data, but will be quicker to process with more specific file path) |
format |
option of how images will be output, either as 'list' a list of file names or 'image' where images will be displayed |
Pull image from reclassified or misclassified files produced during vpr_manual_classification
vpr_img_reclassified(day, hour, base_dir, category_of_interest, image_dir)
vpr_img_reclassified(day, hour, base_dir, category_of_interest, image_dir)
day |
Character string, 3 digit day of interest of VPR data |
hour |
Character string, 2 digit hour of interest of VPR data |
base_dir |
directory path to folder containing day/hour folders in which misclassified and reclassified files are organized (eg.'C:/VPR_PROJECT/r_project_data_vis/classification files/') which would contain 'd123.h01/reclassified_krill.txt' ) |
category_of_interest |
Classification group from which to pull images |
image_dir |
directory path to ROI images, eg. "E:\\data\\cruise_IML2018051\\", file separator MUST BE "\\" in order to be recognized |
folders of misclassified or reclassified images inside image_dir
Displays each image in day hour specified, prompts user to confirm or deny classification. If classification is denied, asks for a reclassification value based on available category
vpr_manual_classification( day, hour, basepath, category_of_interest, gr = TRUE, scale = "x300", opticalSetting = "S2", img_bright = TRUE, threshold_score, path_score )
vpr_manual_classification( day, hour, basepath, category_of_interest, gr = TRUE, scale = "x300", opticalSetting = "S2", img_bright = TRUE, threshold_score, path_score )
day |
day of interest in autoid (3 chr) |
hour |
hour of interest in autoid (2 chr) |
basepath |
path to folder containing autoid files (e.g., 'extdata/COR2019002/autoid') |
category_of_interest |
list of category folders you wish you sort through |
gr |
logical indicating whether pop up graphic menus are used (user preference - defaults to TRUE) |
scale |
argument passed to |
opticalSetting |
specifies optical setting of VPR, defining image frame size, current options are 'S0', 'S1', 'S2' (default), 'S3', see further info in details |
img_bright |
logical value indicating whether or not to include a blown out high brightness version of image (can be helpful for viewing dark field fine appendages) |
threshold_score |
(optional) a numeric value defining the minimum confidence
value, under which automatic classifications will be passed through
manual reclassification. This argument should match the threshold
provided in |
path_score |
(optional) file path to the autoid_cnn_scr folder (autoid files with confidence values produced by automated classification) |
Optical Setting frame sizes: S0 = 7x7 mm, S1 = 14x14mm, S2 = 24x24mm, S3 = 48x48 mm. These settings define the conversion factor from pixels to millimetres and calculate image size for classification reference
Add "undo" functionality to go back on a typing mistake
Fix scaling/ size issue so images are consistently sized
Formats VPR data frame into oce
format CTD object
vpr_oce_create(data)
vpr_oce_create(data)
data |
data frame of vpr data |
E. Chisholm
data('ctd_roi_merge') oce_dat <- vpr_oce_create(ctd_roi_merge)
data('ctd_roi_merge') oce_dat <- vpr_oce_create(ctd_roi_merge)
Creates interpolated contour plot, can be used as a background for ROI or tow yo information
vpr_plot_contour( data, var, dup = "mean", method = "interp", labels = TRUE, bw = 1, cmo )
vpr_plot_contour( data, var, dup = "mean", method = "interp", labels = TRUE, bw = 1, cmo )
data |
data frame needs to include time_hr, depth, and variable of choice (var) |
var |
variable in dataframe which will be interpolated and plotted |
dup |
if method == 'interp'. Method of handling duplicates in interpolation, passed to interp function (options: 'mean', 'strip', 'error') |
method |
Specifies interpolation method, options are 'interp' or 'oce', oce uses slightly different method (oce is least error prone) |
labels |
logical value indicating whether or not to plot contour labels |
bw |
bin width defining interval at which contours are labelled |
cmo |
name of a |
E. Chisholm & Kevin Sorochan
This plot allows a good overview of vertical distribution of individual classification groups along with reference to hydrographic parameters. Facet wrap is used to create distinct panels for each category provided
vpr_plot_profile(category_conc_n, category_to_plot, plot_conc)
vpr_plot_profile(category_conc_n, category_to_plot, plot_conc)
category_conc_n |
A VPR data frame with hydrographic and concentration data separated by category (from |
category_to_plot |
The specific classification groups which will be plotted, if NULL, will plot all category combined |
plot_conc |
Logical value whether or not to include a concentration plot (FALSE just shows CTD data) |
A gridded object of at least 3 ggplot objects
TS balloon plot with ROI concentration, sorted by category includes isopycnal line calculations
vpr_plot_TS(x, reference.p = 0, var)
vpr_plot_TS(x, reference.p = 0, var)
x |
dataframe with temperature, salinity, number of rois (n_roi_bin) |
reference.p |
reference pressure (default at 0 for surface)- used to calculate isopycnals |
var |
variable on which size of points will be based, eg conc_m3 or n_roi_bin |
modified from source: https://github.com/Davidatlarge/ggTS/blob/master/ggTS_DK.R
E. Chisholm
Balloon plot against a TS plot with ROI concentration and sorted by category
includes isopycnal line calculations. Version of vpr_plot_TS
, with only relevant* category specified.
*to current analysis and research objectives (See note).
vpr_plot_TScat(x, reference.p = 0)
vpr_plot_TScat(x, reference.p = 0)
x |
dataframe with temperature, salinity, number of rois named by category |
reference.p |
reference pressure (default at 0 for surface)- used to calculate isopycnals |
WARNING HARD CODED FOR 5 category, CALANUS, KRILL, ECHINODERM LARVAE, SMALL COPEPOD, CHAETOGNATHS !! Uses isopycnal labelling method which does not label every contour
modified from source: https://github.com/Davidatlarge/ggTS/blob/master/ggTS_DK.R
Read prediction output from a CNN model
vpr_pred_read(filename)
vpr_pred_read(filename)
filename |
model prediction output file (.txt) from |
a dataframe
Get roi ids from string
vpr_roi(x)
vpr_roi(x)
x |
A string specifying directory and file name of roi |
A string of only the 10 digit roi identifier
K Sorochan
vpr_hour
, vpr_day
, vpr_category
roi_string <- 'roi.0100000000.tif' vpr_roi(roi_string)
roi_string <- 'roi.0100000000.tif' vpr_roi(roi_string)
Calculates concentrations for each named category in dataframe
vpr_roi_concentration( data, category_list, station_of_interest, binSize, imageVolume, rev = FALSE )
vpr_roi_concentration( data, category_list, station_of_interest, binSize, imageVolume, rev = FALSE )
data |
a VPR dataframe as produced by |
category_list |
a vector of character strings representing category present in the station being processed |
station_of_interest |
The station being processed |
binSize |
passed to |
imageVolume |
the volume of VPR images used for calculating concentrations (mm^3) |
rev |
Logical value defining direction of binning, FALSE (default) - bins will be calculated from surface to bottom, TRUE- bins will be calculated bottom to surface |
data('ctd_roi_merge') ctd_roi_merge$time_hr <- ctd_roi_merge$time_ms /3.6e+06 category_list <- c('Calanus', 'krill') binSize <- 5 station_of_interest <- 'test' imageVolume <- 83663 category_conc_n <- vpr_roi_concentration(ctd_roi_merge, category_list, station_of_interest, binSize, imageVolume)
data('ctd_roi_merge') ctd_roi_merge$time_hr <- ctd_roi_merge$time_ms /3.6e+06 category_list <- c('Calanus', 'krill') binSize <- 5 station_of_interest <- 'test' imageVolume <- 83663 category_conc_n <- vpr_roi_concentration(ctd_roi_merge, category_list, station_of_interest, binSize, imageVolume)
Save VPR data as an as.oce object
vpr_save(data, metadata)
vpr_save(data, metadata)
data |
a VPR data frame |
metadata |
(optional) a named list of character values giving metadata values. If this argument is not provided user will be prompted for a few generic metadata requirements. |
This function will pass a VPR data frame to an oce
object.
Using an oce
object as the default export format for VPR data allows for
metadata and data to be kept in the same, space efficient file, and avoid
redundancy in the data frame. The function checks for data parameters that
may actually be metadata parameters (rows which have the same value
repeated for every observation). These parameters will automatically be
copied into the metadata slot of the oce
object. The function will also
prompt for a variety of required metadata fields. Depending on specific
research / archiving requirements, these metadata parameters could be
updated by providing the argument metadata
.
Default metadata parameters include 'deploymentType', 'waterDepth', 'serialNumber', 'latitudeStart', 'longitudeStart', 'castDate', 'castStartTime', 'castEndTime', 'processedBy', 'opticalSetting', 'imageVolume', 'comment'.
an oce CTD object with all VPR data as well as metadata
data("category_conc_n") metadata <- list('deploymentType' = 'towyo', 'waterDepth' = max(ctd_roi_merge$pressure), 'serialNumber' = NA, 'latitudeStart' = 47, 'longitudeStart' = -65, 'castDate' = '2019-08-11', 'castStartTime'= '00:00', 'castEndTime' = '01:00', 'processedBy' = 'E. Chisholm', 'opticalSetting' = 'S2', 'imageVolume' = 83663, 'comment' = 'test data') oce_dat <- vpr_save(category_conc_n, metadata) # save(oce_dat, file = vpr_save.RData') # save data
data("category_conc_n") metadata <- list('deploymentType' = 'towyo', 'waterDepth' = max(ctd_roi_merge$pressure), 'serialNumber' = NA, 'latitudeStart' = 47, 'longitudeStart' = -65, 'castDate' = '2019-08-11', 'castStartTime'= '00:00', 'castEndTime' = '01:00', 'processedBy' = 'E. Chisholm', 'opticalSetting' = 'S2', 'imageVolume' = 83663, 'comment' = 'test data') oce_dat <- vpr_save(category_conc_n, metadata) # save(oce_dat, file = vpr_save.RData') # save data
Calculates statistics for VPR measurement data in depth averaged bins for analysis and visualization
vpr_size_bin(data_all, bin_mea)
vpr_size_bin(data_all, bin_mea)
data_all |
a VPR CTD and measurement dataframe from |
bin_mea |
Numerical value representing size of depth bins over which data will be combined, unit is metres, typical values range from 1 - 5 |
a dataframe of binned VPR size data statistics including number of observations, median, interquartile ranges, salinity and pressure, useful for making boxplots
## Not run: data('size_df_f') vpr_size_bin(size_df_f, bin_mea = 5) ## End(Not run)
## Not run: data('size_df_f') vpr_size_bin(size_df_f, bin_mea = 5) ## End(Not run)
useful for getting size distribution of known rois from each category. gathers size information from idsize text files produced when training a new classifier in VP (Visual Plankton)
vpr_trrois_size(directory, category, opticalSetting)
vpr_trrois_size(directory, category, opticalSetting)
directory |
cruise directory eg. 'C:/data/IML2018051/' |
category |
list of character elements containing category of interest |
opticalSetting |
VPR optical setting determining conversion between pixels and millimetres (options are 'S0', 'S1', 'S2', or 'S3') |