h2integrate.resource.river#

Classes

RiverResource(**kwargs)

A resource component for processing river discharge data from a CSV file.

RiverResourceConfig(*, filename)

class h2integrate.resource.river.RiverResourceConfig(*, filename)#
Parameters:

filename (str | Path)

filename: str | Path#
class h2integrate.resource.river.RiverResource(**kwargs)#

A resource component for processing river discharge data from a CSV file.

This component reads a CSV file containing river discharge data, processes it, and outputs hourly discharge values for a full year (8760 hours). The input file is expected to have specific formatting, including metadata and discharge data columns with some error handling for missing or malformed data.

CSV files are assumed to have the structure outputted from the USGS Water Information System: https://waterdata.usgs.gov/nwis/uv

initialize()#

Declares the options for the component, including the required "filename" option.

setup()#

Defines the outputs for the component, in this case just the "discharge" array.

compute(inputs, outputs)#

Reads, processes, and resamples the discharge data from the input file. Outputs the hourly discharge values.

Raises:
  • FileNotFoundError -- If the specified file does not exist.

  • ValueError -- If the file does not contain sufficient data or the required discharge column is not found.

initialize()#

Perform any one-time initialization run at instantiation.

setup()#

Declare inputs and outputs.

Available attributes:

name pathname comm options

compute(inputs, outputs)#

Compute outputs given inputs. The model is assumed to be in an unscaled state.

An inherited component may choose to either override this function or to define a compute_primal function.

Parameters:
  • inputs (Vector) -- Unscaled, dimensional input variables read via inputs[key].

  • outputs (Vector) -- Unscaled, dimensional output variables read via outputs[key].

  • discrete_inputs (dict-like or None) -- If not None, dict-like object containing discrete input values.

  • discrete_outputs (dict-like or None) -- If not None, dict-like object containing discrete output values.