ctd_plot: Contour plot for CTD data

Description Usage Arguments Details Value References Examples

View source: R/ctd_plot.R

Description

Plot two-dimensional contours for CTD data by depth and distance

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
ctd_plot(
  dat_in,
  var_plo,
  dep_in = NULL,
  date = NULL,
  date_col = "Date",
  rngs_in = NULL,
  num_levs = 8,
  expand = 200,
  span = 0.05,
  chop = 0,
  add = 0,
  txt_scl = 1,
  stt_scl = 0.7,
  stt_txt = TRUE,
  plot = TRUE,
  xlab = "Channel distance (km)",
  ylab = "Depth (m)",
  var_lab = NULL,
  var_scl = 1.5,
  cols = c("tomato", "lightblue", "lightgreen", "green"),
  msk_col = "grey",
  cont_ext = 0.5,
  ylim = NULL,
  ncol = 100
)

Arguments

dat_in

ctd data along the tidal axis, as a data.frame

var_plo

chr string of variable to plot from dat_in

dep_in

depth soundings from bathymetric soundings

date

chr string of date to plot, only required if input data has more than one sample date

date_col

chr string of name of date column

rngs_in

output from get_rngs, used to scale the colors, see examples

num_levs

numeric for number of contour levels

expand

numeric for expanding sample size of CTD points, see get_depths

span

numeric for smoothing factor to reduce jaggedness of depth values, passed to stats, set to 1e-6 to minimize the smooth

chop

numeric for trimming the depth values

add

numeric for scalar to add to all depth values

txt_scl

numeric for scaling all text labels

stt_scl

numeric for scaling station labels at the top independent of other labels

stt_txt

logical if station labels on top are text for station names or triangles

plot

logical if plot is returned, otherwise the interpolated data are returned

xlab

chr string for x-axis label

ylab

chr string for y-axis label

var_lab

optional chr string of text to include in the plot

var_scl

numeric for text size of var_lab

cols

chr string of colors for the plot

msk_col

chr string for color of masking depth

cont_ext

numeric (meters) for reducing the mask size for the interpolated contour plot, this can be useful to remove white spaces that are not covered by the masking depth but may have an effect on the gradient in the color ramp

ylim

numeric vector for y-axis limits, values must be negative for increasing depth

ncol

numeric indicating degree of smoothing for the color palette

Details

Raw data from the CTD are vertical profiles at unique stations. The data are linearly interpolated along each profile and between stations to create a two-dimensional plotting surface. The dat_in data.frame must have at a minimum six columns for date (Date), longitude (Long), latitude (Lat), station name (Station), depth (Depth, non-negative), and the variable to plot. The dep_in data.frame (if provided) should have three columns for longitude (Long), latitude (Latitude), and depth (Depth, non-negative).

Value

The contour plot if plot = TRUE, otherwise a three-element list with the x values as distance in km, y values as depth, and z values as the interpolated CTD variable

References

Hagy III, JD, Murrell, MC. 2007. Susceptibility of a northern Gulf of Mexico estuary to hypoxia: An analysis using box models. Estuarine, Coastal, and Shelf Science. 74:239-253.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# default plot
dt <- '2014-04-21'
ctd_plot(ctd, var_plo = 'Salinity', dep_in = PB_dep_pts, date = dt)

# get interpolated data
ctd_plot(ctd, var_plo = 'Salinity', dep_in = PB_dep_pts, date = dt, plot = FALSE)

# make color ramp match contour categories in legend
ctd_plot(ctd, 'Salinity', ncol = 8, date = dt)

# change colors
ctd_plot(ctd, 'Salinity', cols = c('Blue', 'Purple', 'Orange'), date = dt)

fawda123/CTDplot documentation built on Feb. 9, 2021, 2:02 p.m.