Create an SSN object from a Landscape Network (LSN).

ssn_assemble(
  edges,
  lsn_path = NULL,
  obs_sites = NULL,
  preds_list = NULL,
  ssn_path,
  import = TRUE,
  overwrite = FALSE,
  verbose = TRUE
)

Arguments

edges

An sf object with LINESTING geometry created using lines_to_lsn (see Details).

lsn_path

Local pathname to a directory in character format specifying where relationships.csv resides, which is created using link{lines_to_lsn}.

obs_sites

Optional. A single sf object with POINT geometry created using link{sites_to_lsn} that represents the observation locations (i.e. where data were collected). Default = NULL (see Details).

preds_list

Optional. A list of one or more sf objects representing prediction sites.

ssn_path

Pathname to an output directory where output files will be stored. A .ssn extension will be added if it is not included.

import

Logical indicating whether the output files should be returned as an SSN object. Defaults to TRUE.

overwrite

Logical. If TRUE and ssn_path already exists, the contents of ssn_path will be overwritten. Defaults to FALSE.

verbose

Logical. Indicates whether messages about the function progress should be printed to the console. Defaults to TRUE.

Value

An object of class SSN. The function returns an object of class SSN. The output is also stored locally in ssn_path (see Details).

Details

The SSNbler package is used to generate the spatial, topological, and attribute information needed to fit spatial stream-network models using the SSN2 package. The ssn_assemble function will often be the final step in the SSNbler data-processing workflow and it is important that the previous processing steps have been followed. Prior to running ssn_assemble, the edges must be processed using link{lines_to_lsn}, link{updist_edges}, and link{afv_edges}. The obs_sites and prediction site datasets in preds_list must be processed with link{sites_to_lsn}, link{updist_sites}, and link{afv_sites}. In addition, the edges, obs_sites, and all of the sf objects in preds_list must be part of the same LSN.

The obs_sites and preds_list are optional arguments, with the Default = NULL. If obs_sites = NULL, an SSN object will be returned with NA stored in ssn.object$obs and a warning returned that ssn.object$obs is required for fitting spatial statistical models in SSN2.

ssn_assemble stores the output locally in ssn_path. If ssn_path does not include the .ssn extension, it is added before the new directory is created. This directory contains:

  • edges.gpkg: edges in geopackage format. A new network identifier, netID, is added that is unique to each subnetwork.

  • sites.gpkg: observed sites in geopackage format (if present). Three new ID columns are added that are unqiue to the measurement (pid), the location (locID), and the network (netID).

  • prediction datasets in geopackage format (if present). The prediction sites also contain pid, locID, and netID. The naming convention is taken from the names provided in preds_list.

  • netID.dat files for each distinct network, which store the binaryID values for line segments in edges.

A more detailed description of the .ssn directory and its contents is provided in Peterson and Ver Hoef (2014).