% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/reservoir_outlet.R
\name{reservoir_outlet}
\alias{reservoir_outlet}
\title{Determine outlet coordinates of reservoirs}
\usage{
reservoir_outlet(flowacc = NULL, dem = NULL, res_vct = NULL,
  outlets_vect = NULL, keep_temp = FALSE, overwrite = FALSE,
  silent = F)
}
\arguments{
\item{flowacc}{Flow accumulation raster in GRASS location used for determination
of reservoir outlets (= highest accumulation value). Set to \code{NULL} if
it should be calculated based on a DEM. Default: \code{NULL}.}

\item{dem}{Digital elevation model in GRASS location used for calculation of
flow accumulation if no flow accumulation raster is given. Default: \code{NULL}.}

\item{res_vct}{Reservoir vector file (polygon) in GRASS location. For each polygon coordinates
of the outlet (cell with highest flow accumulation) are determined. Needs
at least the column \code{res_id} (integer) as reservoir identifier.
If there are no columns \code{elevation} (double) and \code{area} (double) [hectars], they will be added.}

\item{outlets_vect}{Output: Name of vector file of outlet locations to be exported
to GRASS location. Same fields as \code{res_vct}, fields 
 \code{res_id}, \code{elevation} and \code{area} may have been added.}

\item{keep_temp}{\code{logical}. Set to \code{TRUE} if temporary files shall be kept
in the GRASS location, e.g. for debugging or further analyses. Default: \code{FALSE}.}

\item{overwrite}{\code{logical}. Shall output of previous calls of this function be
deleted? If \code{FALSE} the function returns an error if output already exists.
Default: \code{FALSE}.}

\item{silent}{\code{logical}. Shall the function be silent (also suppressing warnings
of internally used GRASS functions)? Default: \code{FALSE}.}
}
\value{
Function returns nothing, but produces \code{outlets_vect}. \bold{WARNING:} Up to version 2.5.0 this function
returned a \code{SpatialPoints} object with the outlet coordinates.
}
\description{
Takes a flow accumulation raster (or DEM for computation) and reservoir vector
file from a GRASS location and estimates the outlet coordinates of each reservoir
polygon. Can be run before \code{\link[lumpR]{reservoir_strategic}} to produce the required input. May also be used to provide outlet points for subbasin delineation.
}
\note{
Prepare GRASS location and necessary files in advance and start GRASS
     session in R using \code{\link[rgrass7]{initGRASS}}. Location should not
     contain any maps ending on *_t as these will be removed by calling the
     function to remove temporary maps.
     
     Internal operations require a non-dbf datatabes driver (SQLite, PostgreSQL, MySQL, ODBC, ...). 
     Automatic switiching to sqlite will be attempted.
     
     \code{res_vct} must not contain a column \code{cat_new} as this will be the new identifier
     column for \code{outlets_vect}.
     
     Check the results by investigating vector file with outlet points written
     to GRASS location. Due to small projection inaccuracies between the DEM / flow
     accumulation raster and the reservoir vector file, calculated outlet locations
     might more or less deviate from true locations!

     Can be run before \code{\link[lumpR]{reservoir_strategic}}.
}
\author{
Tobias Pilz \email{tpilz@uni-potsdam.de}
}
