rvn_rvh_write_subbasingroup {RavenR} | R Documentation |
Write a subbasin group to Raven RVH format
Description
Writes the subbasins in a given RVH object to Raven RVH format in the specified file.
Usage
rvn_rvh_write_subbasingroup(
rvh = NULL,
sbgroup_name = NULL,
outfile = NULL,
subs_per_line = 30,
overwrite = TRUE
)
Arguments
rvh |
rvh object as returned by |
sbgroup_name |
the name of the subbasin group to write to file |
outfile |
the output file to write the subbasin group to |
subs_per_line |
the number of subabsins to write per line in the file (default 30) |
overwrite |
if |
Details
Writes the subbasin group for all subbasins in the rvh$SBtable data frame to file using the ':SubbasinGroup'
command in Raven. This function is intended to be used with rvn_rvh_query
to first subset the
RVH object in order to create useful groups, though this can be done manually as well.
Value
Returns TRUE
if the file is written successfully
Note
Raven has capabilities for creating subbasin and HRU groups that meet certain criteria as well, consider reviewing the ':PopulateSubbasinGroup', ':PopulateHRUGroup', and other commands in Section A.3.2 of the Raven User's Manual.
See Also
rvn_rvh_read
to read a Raven RVH file into R
rvn_rvh_query
to query the RVH file prior to other operations, such as summarizing or writing out subbasin groups)
Examples
# load example rvh file
nith <- system.file("extdata","Nith.rvh",package = "RavenR")
rvh <- rvn_rvh_read(nith)
# query all subbasins upstream of basin 39
rvh_upstream_of_39 <- rvn_rvh_query(rvh, subbasinID=39, condition="upstream_of")
# temporary filename
tf <- file.path(tempdir(), 'mysubbasigroup.rvh')
# write this subbasin group to file
rvn_rvh_write_subbasingroup(rvh=rvh_upstream_of_39, outfile=tf)