plan

Read/write HEC-RAS plan files (.p**).

class rivia.model.plan.Plan(path)[source]

Bases: object

Parser and editor for a HEC-RAS plan file.

Reads the file into memory once, exposes typed properties for commonly changed fields, and writes back to the source path via save().

Unknown lines and lines without an = (e.g. Subcritical Flow) are preserved verbatim so round-trips are faithful.

Parameters:

path (str | Path)

property computation_interval: str | None

Computation time step, e.g. "2MIN", "30SEC".

Key: Computation Interval=

property flow_file: str | None

Flow file extension reference, e.g. u01 or f01 (Flow File=).

property geom_file: str | None

Geometry file extension reference, e.g. g01 (Geom File=).

get(key)[source]

Return the raw stripped value for key, or None if absent/empty.

Use this for fields not exposed as typed properties.

Return type:

str | None

Parameters:

key (str)

property instantaneous_interval: str | None

Instantaneous output interval (Instantaneous Interval=).

Returns None if not present in the plan file.

property is_modified: bool

True if any value has been changed since the last save().

property is_quasi_steady: bool

True if this is a quasi-steady flow plan.

Determined by Flow File= extension starting with q.

property is_sediment: bool

True if this plan includes a sediment file.

Determined by Sediment File= being present.

property is_steady: bool

True if this is a steady flow plan.

Determined by Flow File= extension starting with f.

property is_unsteady: bool

True if this is an unsteady flow plan.

Determined by Flow File= extension starting with u.

property is_water_quality: bool

True if this plan includes a water quality file.

Determined by Water Quality File= being present.

property mapping_interval: str | None

Mapping output interval (Mapping Interval=).

Returns None if not present in the plan file.

property max_iterations: int | None

Maximum iterations per time step (UNET MxIter=).

property output_interval: str | None

Output write interval, e.g. "1HOUR" (Output Interval=).

property program_version: str | None

HEC-RAS version that wrote this plan (Program Version=).

Treat as read-only; HEC-RAS manages this field.

property run_hydraulic_tables: bool

Whether to run hydraulic tables (Run HTab=).

property run_post_process: bool

Whether to run post-processing (Run PostProcess=).

property run_rasmapper: bool

Whether to run RAS Mapper post-processing (Run RASMapper=).

property run_sediment: bool

Whether to run sediment transport (Run Sediment=).

property run_unsteady: bool

Whether to run the unsteady-flow engine (Run UNet=).

property run_water_quality: bool

Whether to run water quality (Run WQNet=).

save()[source]

Write all in-memory lines back to the source plan file.

Return type:

None

property sediment_file: str | None

Sediment file extension reference, e.g. s04 (Sediment File=).

set(key, value)[source]

Set key to value verbatim.

Raises KeyError if the key does not already exist in the file. Use this for fields not exposed as typed properties.

Return type:

None

Parameters:
property short_id: str | None

Short identifier, stripped of padding (Short Identifier=).

property simulation_window: tuple[tuple[str, str], tuple[str, str]] | None

Simulation start and end as ((date, time), (date, time)).

Each date is "DDMONYYYY" and each time is "HHMM" (e.g. (("18FEB1999", "0000"), ("20FEB1999", "2400"))). Returns None if the key is absent.

property theta: float | None

1-D implicit weighting factor (UNET Theta=).

property theta_warmup: float | None

1-D implicit weighting factor during warmup (UNET Theta Warmup=).

property title: str | None

Full plan title (Plan Title=).

property water_quality_file: str | None

Water quality file extension reference, e.g. w01 (Water Quality File=).

property write_ic_at_end: bool

Whether to write IC file at simulation end (Write IC File at Sim End=).

property write_ic_file: bool

Whether to write an initial conditions file (Write IC File=).

property z_tolerance: float | None

Water surface convergence tolerance (UNET ZTol=).