Skip to content

FlowData API Reference

geoloop.loadflowdata.flow_data.FlowData

Class to handle flow rate data for simulations, either as constant, variable, or from a CSV file.

This class provides time-dependent flow data (in kg/s) for simulations. It supports three types of flow profiles:

  • CONSTANT: fixed flow rate over time.
  • VARIABLE: synthetic sinusoidal variation over the year.
  • FROMFILE: flow rates read from a CSV file, optionally smoothed.

Parameters:

Name Type Description Default
type str

Flow type: "CONSTANT", "VARIABLE", or "FROMFILE".

required
base_flow float

Base flow rate (kg/s), default is 1.0.

1.0
peak_flow float

Peak flow rate (kg/s) for VARIABLE type, default is 1.0.

1.0
filepath str

Path to CSV file with flow data, required for FROMFILE type.

None
outdir str

Directory where smoothed CSVs are saved.

None
scale float

Scaling factor for flow data, default is 1.0.

1.0
inputcolumn str

Column name in CSV with flow data, default is "m_flow".

'm_flow'
smoothing int or str

Smoothing for FROMFILE data: - int: rolling average window in samples. - "D": daily average (requires 'local_time' column). - "M": monthly average (requires 'local_time' column). - None or "none": no smoothing.

None

__init__

__init__(
    type: str,
    base_flow: float = 1.0,
    peak_flow: float = 1.0,
    filepath: str | Path | None = None,
    outdir: str | Path | None = None,
    inputdir: str | Path | None = None,
    scale: float = 1.0,
    inputcolumn: str = "m_flow",
    smoothing: int | str | None = None,
) -> None

Initialize the FlowData object.

getflow

getflow(x: ndarray) -> np.ndarray

Return flow values at specified times.

Parameters:

Name Type Description Default
x array - like

Array of time points in hours at which to get flow values.

required

Returns:

Type Description
ndarray

Flow rates (kg/s) (interpolated or analytically computed) at the requested time points.

from_config classmethod

from_config(config: FlowDataConfig) -> FlowData | None

Create a FlowData instance from a configuration dictionary.

The configuration dictionary must include keys defining the flow type and file paths if applicable.

Parameters:

Name Type Description Default
config FlowDataConfig

Configuration object with keys.

required

Returns:

Type Description
FlowData

Initialized FlowData object.