dss_path_functions: Functions for searching pathnames in a DSS file

dss_path_functionsR Documentation

Functions for searching pathnames in a DSS file

Description

Functions to search for path names in DSS files.

Usage

getCatalogedPathnames(file)
getPaths(file, searchString)
getPaths(file, searchString, searchFunction, ...)
getAllPaths(file, rebuild=TRUE)
splitPattern(pattern)
separatePathParts(paths)

Arguments

file

dss file from opendss

searchString

string sent to filter for search, see detail section on filters.

searchFunction

function used to search, defaults to path by parts.

useRegex

boolean to determine if regex or wildcards should be used.

Details

functions ending in Wildcard use the standard "*" to match wildcard characters, converting search strings with glob2rx. Search functions ending in Regex use the grepl function to test parts.

fullPath functions expect a six part full path name (e.g. /A/B/C/D/E/F/), with asterisks for unknown parts, as blanks match blank path parts.

pathByParts functions use the format "A=PATTERN B=PATTERN" for their search string. Parts not specified will be searched for as a wildcard

getCatalogedPathnames and getCondensedCatalog calls 'getCatalogedPathnames' and 'getCondensedCatalog' functions in Java API and converts result to R character vector.

getAllPaths tries to read the DSS catalog file (does not work in R 4.0) instead of calling Java API and should be deprecated.

See Page 8-32 of the HEC-DSSVue manual for further examples on the wildcard methods. The "at" character cannot be used as a wildcard.

Custom search functions can be written to take the first two parameters as the full list of paths as a character vector, and a search pattern string. The search pattern string can be provided as an empty string with other parameters provided for the search. splitPattern will split a path by parts pattern into search terms, and separatePathParts will split a full path pattern into search terms.

Value

list or data.frame of pathnames

Author(s)

Evan

Examples


# recommended search technique:
paths = pathsToDataFrame(getCatalogedPathnames(dssfile), simplify=T)
bwCreekStagePaths = subset(paths, LOCATION="BRANDYWINE CREEK", PARAMETER="STAGE")$PATH

# these can be a little flaky.
getPaths(dssfile, "A=BRANDYWINE CREEK B=WILMINGTON, DE C=STAGE F=USGS")
getPaths(dssfile, "A=BRANDYWINE CREEK B=WILMINGTON, DE C=STAGE F=USGS", pathByPartsWildcard)
getPaths(dssfile, "A=BRANDYWINE CREEK B=WILMINGTON, DE C=STAGE F=US.*", pathByPartsRegex)
getPaths(dssfile, "/BRANDYWINE CREEK/WILMINGTON, DE/STAGE/*/*/USGS/")
getPaths(dssfile, "/BRANDYWINE CREEK/WILMINGTON, DE/STAGE/*/*/USGS/", fullPathByWildcard)
getPaths(dssfile, "/BRANDYWINE CREEK/WILMINGTON, DE/STAGE/.*/.*/USGS/", fullPathByRegex)
getAllPaths(dssfile)
getAllPaths(dssfile, rebuild=TRUE)

eheisman/dssrip documentation built on Feb. 10, 2024, 2:40 p.m.