interpolate_section: Interpolate x-y-z data for oceanographic section plots

Description Usage Arguments Details Value Author(s)

View source: R/interpolate_section.R

Description

Wrapper function which interpolates 3D data. Designed for oceanographic section plots.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
interpolate_section(
  df = NULL,
  x,
  y,
  z,
  method = "linear",
  format = "ggplot",
  nx = 100,
  ny = 100,
  scale_distances = FALSE,
  log_y = FALSE,
  extrapolate = FALSE,
  na.rm = TRUE,
  return_df_names = FALSE
)

Arguments

df

data frame. Can be NULL if x, y, z are given as numeric vectors

x, y, z

coordinates as numeric vectors, if df = NULL. Otherwise characters specifying the column names of the coodrinates in df. The interpolation will be done as f(x, y) ~ z

method

Character specifying the interpolation method. Options: "linear", "spline", "mba", and "idw"

format

Character specifying the output format. Options: "ggplot" (for plotting with ggplot2), "image" (for plotting with the image function) or "wide" for exporting as a wide data frame.

nx, ny

Integer giving the dimensions for the output

scale_distances

Logical indicating whether x and y should be scaled to equal distances. May be useful when interpolating variables that have different units or distances.

log_y

logical indicating whether y axis should be interpolated using log10(y + 1) scale.

extrapolate

logical indicating whether the interpolation function should be allowed to extrapolate beyond initial data.

na.rm

logical indicating whether rows containing NA values should be omited from df or x, y, z. NA values are not permitted in most of the interpolation methods. See sectionGrid for one way of interpolating NA values away from the input dataset.

return_df_names

logical indicating whether the original column names should be returned instead of x, y, and z if df != NULL

Details

This is a wrapper function which uses existing interpolation solutions. Following interpolation methods have been implemented:

Value

Returns a data.frame with interpolated x,y,z coordinates.

Author(s)

Mikko Vihtakari


MikkoVihtakari/WaterMass documentation built on Jan. 27, 2022, 11:50 p.m.