/UVP_plots_basic

Scripts to plot UVP data exported from Ecotaxa in detailed ODV format

Primary LanguageMATLAB

UVP_tools | Basic tools for reading and plotting UVP data

Introduction

This repository was developed to simplify visualizing Underwater Vision Profiler (UVP) data for the multiple users in the McDonnell Lab group. Code has been adapted and built from the original work of Dr. Andrew McDonnell, Jessica Pretty, and Stephanie O'Daly.

See McDonnell Lab's GitHub page: https://github.com/amcdonnell-lab

This toolbox is very much a work in progress and I welcome feedback and comments.

UVP_submission_formatting may also be useful and is a repository that provides scripts to reformat UVP data downloaded from Ecotaxa for submission to data archival websites SeaBASS and BCO-DMO.

MATLAB dependencies & requirements

This toolbox was created using Matlab R2017b and tested on Matlab R2019a on both a PC and Mac. Matlab version R2016b or higher is required. Users must have m_map. If any dependent functions are missing in the utility folder please let me know.

Data format requirements

UVP data must be exported in detailed ODV format from Ecotaxa. See how-to wiki page for instructions.


Setting up the workflow

All example plots were generated using the data in the testing folder. This data is from a 2015 repeat hydrography cruise along the p16 line in the North Pacific. More information on the cruise and data can be found in the archived datasets BCO-DMO PAR Dataset and here BCO-DMO ZOO Dataset. Data were formatted for archival using the publicly available repository UVP_submission_formatting.

_[project]plot_config.m

This script is the starting place where you define the project, filepath to your project (for example: options.project = fullfile('UVP_plots_basic','testing','UVP_plots_basic_exports')), parameter to grid data by (e.g. time, lat, or lon), and various other options defined in config_script.

  • (OPTIONAL) USER hardcodes which variables you want to plot - see example for details. If this is not hardcoded, user will be prompted to select variables.

UVP_workflow.m | START HERE!

This script is the wrapper script! call as follows: UVP_workflow(toolbox_dir,config_script), where toolbox_dir is the path to this repository and config_script is the path to the project configuration script. For example: config_script = fullfile('UVP_plots_basic','testing','UVP_plots_basic_exports','exports_plot_config.m") Below are the section headers (use code-folding in Matlab Editor to see section headers clearly).

  • Read configuration script - this calls the config_script defined in the input arguments
  • Read PAR file and calculate parameters from particle abundance and biovolume data
  • Read ZOO file with option to limit plotting to fully validated stations
  • Read CTD data (this will be implemented soon, but is not ready yet)
  • Remove unwanted profiles (OPTIONAL if user defines these in the config_script)
  • Prompt: Determine which variables to plot, if not hardcoded.
  • Remove two deepest depth bins in every profile
  • Prompt: Decide if want to plot sections of data, or the whole range
  • PLOT | Plot standard 3 panel total particle abundance, total particle biovolume, and slope of PSD
  • PLOT | Plot vertical profiles of different sizes at each station
  • Loops through fields select to plot
  • NON-GRIDDED: Waterfall plot - shows evolution of profiles throughout cruise
  • NON-GRIDDED: plot_data_vs_depth(options);
  • GRIDDED: Waterfall plot - shows evolution of data throughout cruise
  • GRIDDED: 2D contour plot
  • GRIDDED: 3D contour plot

UVP_read_odv_ecotaxa_exported_par.m

Reads in the UVP PAR file exported from Ecotaxa in detailed ODV format. Data is returned as structure par with information on each field in par_info.

[par_table, par_info] = UVP_read_odv_ecotaxa_exported_par(par_file);

UVP_calculate_PAR_fields.m

Calculates common variables from the standard UVP particulate output from Ecotaxa. I.e. particulate abundance [#/L] and particulate biovolume [ppm] or [mm^3/L]. New fields will be added here as the repository evolves.

[par,par_info] = UVP_calculate_PAR_fields(par_table,par_info);

UVP_read_odv_ecotaxa_exported_zoo.m

Reads in the UVP ZOO file exported from Ecotaxa in detailed ODV format. Data is returned as structure zoo with information on each field in zoo_info.

[zoo, zoo_info] = UVP_read_odv_ecotaxa_exported_zoo(zoo_file);

Read_hydrographic_cruise_hyfiles.m

This will likely be replaced in the future, with something to read in a variety of CTD and bottle data and merge with UVP data.

UVP_select_paramets_to_plot.m

Prompts the user to select which variables to plot. If user selects a variable in NxM size such as NSD or biovolume, it asks again which size class or taxa to plot. At the end of the script, it will print formatted text to the screen so you don't have to run through this repeatedly.

EXAMPLE: data.tot_par_abundance (i.e. "total particle abundance") and data.VSD (i.e. "particle biovolume"). Since VSD is an NxM array, you need to define which sizes you want to use.

*********************************************************************************
To hardcode these selections, copy and paste this into your UVP_workflow.m script
*********************************************************************************
plots.tot_par_abundance       = struct();
plots.tot_par_abundance.title = {'Abundance (102-203µm)[#/L]'};
plots.tot_par_abundance.clims = [5.35 57.86];
plots.VSD.title = {'Biovolume (102-128_µm)[ppm]'; 'Biovolume (128-161_µm)[ppm]'; 'Biovolume (161-203_µm)[ppm]'};
plots.VSD.clims = [[0.0002 0.00366];[0.000559 0.0094];[0.00058 0.0106]];

uvp_remove_last_two_depth_bins.m

Removes the two deepest depth bins from each profile. Since the UVP is installed on a CTD rossette there is more time spentat the deepest point in the profile, as the winch is stopped and reverse. Because of this, the counts in the lowest depth bins can be biased to higher counts. [data] = uvp_remove_last_two_depth_bins(data);

select_data_sections.m

Walks through loading sections for visualizations. Prompts the user to split the dataset given two options; 1) select the number of days or 2) click points on a map.

get_bathymetry.m

Saves high resolution coastline data using m_gshh_f.m and loads & saves bathymetry using input longitude, latitude.
Bathymetry is read in from file [project_name '_bathymetry.txt'] if possible. If bathymetry file is not available, it is loaded using m_map's m_elev.m. How to download your own high resolution bathymetric data

  1. EXTRACT XYZ GRID - TOPOGRAPHY OR GRAVITY : https://topex.ucsd.edu/cgi-bin/get_data.cgi
  2. COPY AND SAVE WEB QUERY RESULTS TO: [project_name '_bathymetry.txt']

UVP_griddata.m

Grid input Nx1 data into NxM data matricies using Matlab's griddata.m function. Allows more control of how data is gridded. See script documentation for more.

cfg.stophere = 1;         % 1 = stops at the end of the script and plots the gridded data so the user can see how the configuration options influence the visualization
cfg.y_step   = 100;       % [meters] UVP data output in 5m bins from Ecotaxa
cfg.y_start  = 0;         % [meters] depth of first vertical bin
cfg.method   = 'natural'; % interpolation method 'natural','linear' or 'nearest'
cfg.maskXbyZ = 1;         % 1 = masks interpolation over vast horizontal distances, 0 = no mask applied - will interpolate over everything
cfg.scalexy  = 1;         % 1 = rescale axes so the x and y dimensions span a comparable range of values (useful for fixing horizontal streaking issues)
cfg.finite   = 1;         % 1 = ignores all NaNs - may help solve poor gridding coverage

Plots

See plotting functions wiki page for examples.


Citation/acknowledgement

If you use this toolbox, please cite as follows: Brita Irving, (2021), UVP_plots_basic, GitHub repository, https://github.com/britairving/UVP_plots_basic