h2integrate.resource.tidal#
Classes
|
A resource component for processing tidal data from a CSV file. |
|
- class h2integrate.resource.tidal.TidalResourceConfig(*, resource_dir=None, resource_filename='')#
- Parameters:
resource_dir (str | Path, optional) – Folder to save resource files to or
"". (load resource files from. Defaults to)
resource_filename (str, optional) – Filename to save resource data to or load resource data from. Defaults to None.
- resource_dir: Path | str | None#
- resource_filename: Path | str#
- class h2integrate.resource.tidal.TidalResource(**kwargs)#
A resource component for processing tidal data from a CSV file.
This component reads a CSV file containing tidal data, processes it, and outputs hourly tidal velocity values for a full year (8760 hours). The input file is expected to have specific formatting, including metadata and day and time, and speed data columns with some error handling for missing or malformed data.
Notes
- The tidal resource data should be in the format:
Rows 1 and 2: Header rows with location info.
- Row 3: Column headings for time-series data
(Year, Month, Day, Hour, Minute, Speed).
Rows 4+: Data values:
Speed (current speed) in meters/second.
- initialize()#
Declares the options for the component, including the required “filename” option.
- setup()#
Defines the outputs for the component, in this case just the “tidal_velocity” array.
- compute(inputs, outputs)#
Reads, processes, and resamples the data from the input file. Outputs the hourly tidal velocity values.
- Raises:
FileNotFoundError – If the specified file does not exist.
ValueError – If the file does not contain sufficient data or the required speed 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.