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:
objectRead-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
Nonewhen the project has no current plan set.
- property default_exp_contr: tuple[float, float] | None¶
Default expansion/contraction coefficients as
(expansion, contraction).Returns
Noneif the field is absent or malformed.
- property description: str¶
Project description text (between
BEGIN DESCRIPTION:andEND DESCRIPTION:).
- get(key)[source]¶
Return the raw stripped value for key, or
Noneif absent/empty.Use this for fields not exposed as typed properties (e.g.
'Y Axis Title').
- get_all(key)[source]¶
Return all raw stripped values for repeated key lines.
Use this for repeated fields not exposed as typed properties.
- property plan_short_ids: list[str | None]¶
Short Identifierfor each plan file, in project order.A
Noneentry means the plan file does not exist or has noShort Identifier=line.
- property plan_titles: list[str | None]¶
Plan Titlefor each plan file, in project order.A
Noneentry means the plan file does not exist or has noPlan 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"— fullPathto the plan file"title"— value ofPlan Title=, orNone"short_id"— value ofShort Identifier=, orNone
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 steady_flow_files: list[Path]¶
Full paths to all steady flow files (
Flow File=) listed in the project.