nfd_extract: Extract subsets from nfd objects

View source: R/nfd_extract.R

nfd_extractR Documentation

Extract subsets from nfd objects

Description

Extract subsets from nfd (and crss_nf, and crssi) objects by time, trace, site, flow space, and/or timestep dimensions.

Usage

nfd_extract(x, i, j, k, l, m)

Arguments

x

An object inheriting from nfd.

i

The times to extract. Can be numeric or ISO-8601 style character range. See details.

j

Traces to extract. Numeric.

k

Sites to extract. Numeric or names of sites. Must be missing, or all sites if extracting from crssi objects.

l

The flow space. "intervening", "total", or c("total", "intervening").

m

The time step to get. "annual", "monthly", or c("annual", "monthly").

Details

When calling nfd_extract() not all dimensions have to be specified. When dimensions are not specified, all data for that dimension are returned.

Times (i) can be specified by row index or ISO-8601 style character ranges. For example: "2000/2002" would return all data for 2000-2002. See [.xts for more details.

When extracting from a crssi object, all sites must remain. Additionally, there must be intervening monthly flow remaining after the extraction is complete, or an error will post. For crss_nf objects, the extraction is less strict, and will return a nfd object instead of erroring.

Value

nfd_extract() returns an nfd object if x is an nfd object. If x is a crss_nf object, a crss_nf object is returned, unless the extraction results in an invalid crss_nf object, i.e., there are less than the required 29 sites and/or the time_step or flow_space no longer includes monthly intervening data.


BoulderCodeHub/CRSSIO documentation built on July 2, 2023, 5:15 p.m.