riverarchitect.config

Project-wide configuration: paths, units and the canonical NoData value.

Paths are resolved with os.path so that the same constants work on Windows and POSIX. The original River Architect hard-coded "\\" separators throughout, which is one of the reasons it could only run on Windows.

Data directories are resolved relative to a project root, which is by default the current working directory. Point RIVERARCHITECT_HOME at a directory to override it, or call set_project_home() at runtime.

riverarchitect.config.NODATA = -999.0

Canonical NoData value for every raster River Architect writes.

Never test cell values against this constant directly. Go through the declared NoData mask instead (rasterio.open(...).read(masked=True)), because third-party inputs carry -3.4e38, 3.4e38, 0 or -9999 interchangeably. Use riverarchitect.tools.reconcile_nodata to normalise an input condition.

riverarchitect.config.FT2AC = 2.295684113865932e-05

Square feet to acres.

riverarchitect.config.FT2M = 0.3048

Feet to metres.

riverarchitect.config.CFS2CMS = 0.0283168466

Cubic feet per second to cubic metres per second.

riverarchitect.config.UNITS = ('us', 'si')

Supported unit systems.

riverarchitect.config.package_dir()[source]

Directory of the installed riverarchitect package.

riverarchitect.config.templates_dir()[source]

Directory holding packaged templates (layer styles, workbooks).

riverarchitect.config.symbology_dir()[source]

Directory holding packaged QGIS layer styles (.qml).

riverarchitect.config.project_home()[source]

Root directory of the user’s project data.

Resolution order: an explicit set_project_home(), then the RIVERARCHITECT_HOME environment variable, then the current working directory.

riverarchitect.config.set_project_home(path)[source]

Set the project root that the dir_* helpers resolve against.

riverarchitect.config.dir_conditions()[source]

Directory holding input conditions (one sub-folder per condition).

riverarchitect.config.dir_flows()[source]

Directory holding flow series and duration workbooks.

riverarchitect.config.dir_maps()[source]

Directory holding map output (QGIS projects and PDFs).

riverarchitect.config.dir_output(module='')[source]

Output directory, optionally for a named module.

riverarchitect.config.area_unit(unit='us')[source]

Area unit label for a unit system: 'sqft' or 'sqm'.

riverarchitect.config.unit_labels(unit='us')[source]

Discharge, depth, velocity, length and volume labels for a unit system.

Returns:

keys q, h, u, length, volume, area.

Return type:

dict