bin_average: Bin average: Average variables by depth/pressure bin

View source: R/sbe_modules.R

bin_averageR Documentation

Bin average: Average variables by depth/pressure bin

Description

Calculate averages for variables by depth or pressure bin.

Usage

bin_average(
  x,
  by = "depth",
  bin_width = 1,
  exclude_surface = 0.5,
  exclude_bad_flag = TRUE,
  interpolate_missing = TRUE,
  missing_latitude = 55
)

Arguments

x

ctd object

by

Grouping variable as a character vector ("depth" or "pressure")

bin_width

Width of bins to use for binning.

exclude_surface

Depth or pressure (down is positive) as numeric vector (1L). Scans will be excluded from binning if they are shallower this threshold.

exclude_bad_flag

Logical indicating whether to remove scans with a bad (negative) flag.

interpolate_missing

Interpolate variables when there are no good data for a depth/pressure bin.

missing_latitude

Latitude in decimal degrees to use for depth estimation if ctd object does not contain latitude.

Value

ctd object with variables binned and 'flag' column removed.

Author(s)

Sean Rohan


sean-rohan-NOAA/gapctd documentation built on March 1, 2025, 9:27 a.m.