Commit 4c562165 authored by Thomas Shatwell's avatar Thomas Shatwell
Browse files

Introduced new function profile2grid().

parent b08dc5ee
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/profile2grid.R
\name{profile2grid}
\alias{profile2grid}
\title{Interpolation of sonde profiles to a grid of fixed depths}
\usage{
profile2grid(data, datetime, depth, value, outdepths = NULL, rule = c(2, 1))
}
\arguments{
\item{data}{A data.frame containing the profile data to interpolate, containing columns of at least datetime, depth and values.}
\item{datetime}{The name of the column containing the datetimes (character). Datetimes must be in POSIXct format.}
\item{depth}{The name of the column containing the depths (character).}
\item{value}{The name of the column containing values to be interpolated (character).}
\item{outdepths}{The interpolation depths, which defines the desired vertical grid (numeric vector). If \code{NULL}, the function tries to choose suitable depths.}
\item{rule}{The rule defining how to interpolate outside the data range, as defined in the function \code{approxfun()} function.
Copied again: an integer (of length 1 or 2) describing how interpolation is to take place outside the interval \link{min(x), max(x)}.
If rule is 1 then NAs are returned for such points and if it is 2, the value at the closest data extreme is used.
Use, e.g., rule = 2:1, if the left and right side extrapolation should differ.}
}
\value{
A \code{matrix} containing the interpolated profile data, nrow = the length of outdepths, and ncol=the number of profiles.
The attributes contain some details including the \code{outdepths}.
}
\description{
Interpolates vertical profile data (typically from a sonde or profiling system) to defined depths.
It uses \code{data.table} to more quickly and efficiently process large datasets.
}
\details{
The function takes as input a table in long format, with columns for a timestamp, depth, and measured values.
}
\examples{
\dontrun{
out <- profile2grid(...)
}
}
\author{
Tom Shatwell
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment