View source: R/function_OutletNearObs.R
OutletNearObs | R Documentation |
Find observation stations close to specified outlet subbasins of a HYPE model set-up. Proximity threshold as upstream area fraction of target outlet subbasin(s). Currently, only upstream observations are identified.
OutletNearObs(
gd,
file.qobs = NULL,
file.xobs = NULL,
variable = NULL,
outlets = NULL,
frac.drain = 0.8,
nearest.only = TRUE,
verbose = TRUE
)
gd |
Data frame with two columns |
file.qobs , file.xobs |
Character string, file location of HYPE observation data file. Only one of these needs to be
supplied, with |
variable |
Character string, HYPE variable to use. Needed only with argument |
outlets |
Integer vector, HYPE SUBIDs of subbasins to be considered outlets. If |
frac.drain |
Numeric, minimum fraction of drainage area at corresponding outlet to be covered by observation site. |
nearest.only |
Logical, if |
verbose |
Logical, print status messages and progress bars during runtime. |
OutletNearObs
finds observation sites for observation variables in
HYPE 'Qobs.txt' and
HYPE 'Xobs.txt' files
located upstream an outlet sub-basin. For file.xobs
files, which can hold several observation variables, a single variable has
to be selected (the function conveniently prints available variables in file.xobs
, if no variable
is provided).
Any number of SUBIDs present in gd
can be defined as outlet subbasins with argument outlets
. The function handles nested
outlets, i.e. cases where user-provided subbasins in outlets
are upstream basins of one another. Outlet proximity is
defined by drainage area size compared to the respective outlet. The function returns either the nearest or all sites matching
or exceeding fraction frac.drain
, depending on argument nearest.only
.
OutletNearObs
returns a data frame with 4 columns, containing row-wise all observation sites which match the search
criteria:
SUBID of outlet subbasin
SUBID of observation site
Relative drainage area fraction of observation site, compared to corresponding outlet subbasin
Drainage area of outlet subbasin, in km^2
Drainage area of observation site, in km^2
If file.xobs
is provided without variable
, the function prints available HYPE observation variables in file.xobs
and silently
returns the same information as character vector.
# Import source data
te <- ReadGeoData(filename = system.file("demo_model", "GeoData.txt", package = "HYPEtools"))
# Find observation near domain outlet
OutletNearObs(file.qobs = system.file("demo_model", "Qobs.txt", package = "HYPEtools"), gd = te,
verbose = FALSE)
# get vector of variables in an Xobs file
OutletNearObs(file.xobs = system.file("demo_model", "Xobs.txt", package = "HYPEtools"), gd = te,
verbose = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.