openSTARS (version 1.0.0)

calc_binary: Calculate binary IDs for each stream network.

Description

Calculate binary IDs for each stream network built up by '0' and '1'. This function is called by export_ssn and there is no need for it be called by the users.

Calculate binary IDs for each stream network built up by '0' and '1'. This function is called by export_ssn and there is no need for it be called by the users.

Usage

calc_binary()

calc_binary()

Arguments

Value

A list with one slot for each network id containing a data frame with 'rid' and 'binaryID' for each segment belonging to this network.

A list with one slot for each network id containing a data frame with 'rid' and 'binaryID' for each segment belonging to this network.

Examples

Run this code
# NOT RUN {
# Initiate GRASS session
if(.Platform$OS.type == "windows"){
  gisbase = "c:/Program Files/GRASS GIS 7.2.0"
  } else {
  gisbase = "/usr/lib/grass72/"
  }
initGRASS(gisBase = gisbase,
    home = tempdir(),
    override = TRUE)

# Load files into GRASS
dem_path <- system.file("extdata", "nc", "elev_ned_30m.tif", package = "openSTARS")
sites_path <- system.file("extdata", "nc", "sites_nc.shp", package = "openSTARS")
setup_grass_environment(dem = dem_path, sites = sites_path)
import_data(dem = dem_path, sites = sites_path)
gmeta()

# Derive streams from DEM
derive_streams(burn = 0, accum_threshold = 700, condition = TRUE, clean = TRUE)

# Check and correct complex junctions (there are no complex juctions in this 
# example date set)
cj <- check_compl_junctions()
if(cj){
  correct_compl_junctions()
}

# Prepare edges
calc_edges()

# Prepare site
calc_sites()

binaries <- calc_binary()
head(binaries[[1]])
# }

Run the code above in your browser using DataLab