% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/def.srf.aply.R
\name{def.srf.aply}
\alias{def.srf.aply}
\title{Apply SRF records to data in a publication table}
\usage{
def.srf.aply(
  srf,
  dataTabl,
  pubWbTabl,
  NameVarTimeBgn = "startDateTime",
  NameVarTimeEnd = "endDateTime",
  log = NULL
)
}
\arguments{
\item{srf}{Data frame of science review flag records to apply, as produced by NEONprocIS.pub::def.read.srf
with column qfFinl added by applying def.srf.qf.finl. Note that the srf records should already be filtered 
for those corresponding to the location/product instance of the data in dataTabl 
(i.e. (site, domain, HOR, VER).}

\item{dataTabl}{Data frame of data for a single publication workbook table. Note that the column names in the data frame
should match those in the pub workbook (need not be ordered the same).}

\item{pubWbTabl}{Data frame of the publication workbook filtered for the publication table corresponding to dataTabl.}

\item{NameVarTimeBgn}{Character string. The name of the time variable in dataTabl (and pubWbTabl) indicating 
the start time of the aggregation interval. Default is 'startDateTime'.}

\item{NameVarTimeEnd}{Character string. The name of the time variable in dataTabl (and pubWbTabl) indicating 
the end time of the aggregation interval. If the data are instantaneous output, set NameVarTimeEnd to the same variable as 
NameVarTimeBgn. If any part of the aggregation interval falls within the time range of the SRF, 
the SRF will be applied. Note that the aggregation end time and SRF end time are exclusive, meaning they are not considered 
part of the interval. Default is 'endDateTime'.}

\item{log}{A logger object as produced by NEONprocIS.base::def.log.init to produce structured log
output. Defaults to NULL, in which the logger will be created and used within the function.}
}
\value{
A data frame with the same format and size of dataTabl, with applicable SRF actions applied.
}
\description{
Apply the science review flag to the data in a publication table (i.e. L1+).
Application of the science review flag involves:
1) Populating the SRF field/column in the publication table with the SRF value in each SRF record for the time
   interval over which it applies,
2) Forcing the final quality flag to 1 if the value of the SRF is 1 or 2. Note that a SRF value of 0 indicates
that a previous manual flag was removed and the final quality flag is computed normally, 
3) Setting terms/columns to be redacted to NA if the SRF value is 2. The terms to redact are indicated in the 
publication workbook - the redactionFlag column for these terms is populated with the measurement stream 
of the SRF.
}
\examples{
Currently none
NOT RUN.
Add the qfFinl column to the SRF table
srf$qfFinl <- NEONprocIS.pub::def.srf.term.qf.finl(termSrf=srf$srf_term_name,log=log)
}
\references{
License: (example) GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007
}
\seealso{
\link[NEONprocIS.pub]{def.read.srf}

\link[NEONprocIS.pub]{def.read.pub.wb}

\link[NEONprocIS.pub]{def.srf.term.qf.finl}
}
\author{
Cove Sturtevant \email{csturtevant@battelleecology.org}
}
\keyword{Currently}
\keyword{none}
