project

Read HEC-RAS project files (.prj).

Note: HEC-RAS .prj files are unrelated to ESRI projection (.prj) files.

class rivia.model.project.Proj(path)[source]

Bases: object

Read-only parser for a HEC-RAS project file (.prj).

Parses the project file to expose project metadata, unit system, and lists of associated file extensions (geometry, plan, flow, etc.).

Example

>>> prj = Proj("Baxter.prj")
>>> prj.title
'Baxter River GIS Example'
>>> prj.units
'English'
>>> prj.current_plan_file
PosixPath('Baxter.p01')

Derived from: HEC-RAS project file format (no archive equivalent).

Parameters:

path (str | Path)

property current_plan_ext: str | None

Extension of the current plan file, e.g. 'p01'.

Returns None when the project has no current plan set.

property current_plan_file: Path | None

Full path to the current plan file, or None if unset.

property default_exp_contr: tuple[float, float] | None

Default expansion/contraction coefficients as (expansion, contraction).

Returns None if the field is absent or malformed.

property description: str

Project description text (between BEGIN DESCRIPTION: and END DESCRIPTION:).

property dss_end_date: str | None

DSS simulation end date string, or None if unset.

property dss_end_time: str | None

DSS simulation end time string, or None if unset.

property dss_start_date: str | None

DSS simulation start date string, or None if unset.

property dss_start_time: str | None

DSS simulation start time string, or None if unset.

property geom_files: list[Path]

Full paths to all geometry files listed in the project.

get(key)[source]

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

Use this for fields not exposed as typed properties (e.g. 'Y Axis Title').

Return type:

str | None

Parameters:

key (str)

get_all(key)[source]

Return all raw stripped values for repeated key lines.

Use this for repeated fields not exposed as typed properties.

Return type:

list[str]

Parameters:

key (str)

property path: Path

Absolute path to the project file.

property plan_files: list[Path]

Full paths to all plan files listed in the project.

property plan_short_ids: list[str | None]

Short Identifier for each plan file, in project order.

A None entry means the plan file does not exist or has no Short Identifier= line.

property plan_titles: list[str | None]

Plan Title for each plan file, in project order.

A None entry means the plan file does not exist or has no Plan Title= line.

property plans: list[dict[str, str | Path | None]]

Metadata for each plan file in project order.

Each entry is a dict with keys:

  • "ext" — file extension token, e.g. 'p01'

  • "path" — full Path to the plan file

  • "title" — value of Plan Title=, or None

  • "short_id" — value of Short Identifier=, or None

Results are cached after the first access.

property quasi_steady_files: list[Path]

Full paths to all quasi-steady files listed in the project.

property sediment_files: list[Path]

Full paths to all sediment files listed in the project.

property steady_flow_files: list[Path]

Full paths to all steady flow files (Flow File=) listed in the project.

property title: str | None

Project title (Proj Title=).

property units: Literal['English', 'SI']

'English' or 'SI'.

Type:

Unit system

property unsteady_flow_files: list[Path]

Full paths to all unsteady flow files listed in the project.

property water_quality_files: list[Path]

Full paths to all water quality files listed in the project.