riverarchitect.tools
Command-line maintenance tools. Each is runnable as a module
(python -m riverarchitect.tools.<name>) and is also installed as a console script.
reconcile_nodata
Reconcile the NoData value of every raster in a condition folder to River Architect’s canonical NoData value (config.nodata = -999.0).
Rationale
Conditions assembled from different preprocessing chains carry inconsistent NoData values (-3.4e38, +3.4e38, 0.0, -9999, -128, …). All of them are declared in the GeoTIFF header, so a mask-aware read handles them correctly - but 21 call sites in River Architect use arcpy.RasterToNumPyArray(…, nodata_to_value=0) or compare cell values directly, and those behave differently depending on which sentinel the input file happens to use.
This tool rewrites the sentinel while preserving the NoData mask exactly. Cells that were NoData before are still NoData afterwards, so raster semantics (e.g. IsNull(veg_ras) meaning “no existing vegetation”) are unchanged.
Usage
python -m riverarchitect.tools.reconcile_nodata <directory> [–dry-run] [–recursive]
# a single condition python -m riverarchitect.tools.reconcile_nodata 01_Conditions/rsrm_test # preview only python -m riverarchitect.tools.reconcile_nodata 01_Conditions/rsrm_test –dry-run
Requires rasterio/GDAL. It does not use arcpy, so it runs on any platform. Stale .aux.xml / .ovr sidecars are removed so that statistics and pyramids are rebuilt from the corrected data.
- riverarchitect.tools.reconcile_nodata.representable(value, dtype)[source]
True if value can be stored in dtype without overflow or truncation.
- riverarchitect.tools.reconcile_nodata.target_dtype(dtype)[source]
Return a dtype that can hold NODATA, promoting the original as little as possible.
- riverarchitect.tools.reconcile_nodata.reconcile(path, dry_run=False)[source]
Rewrite one raster so that its NoData value is NODATA. Returns True if changed.
lyrx2qml
Convert an ArcGIS Pro layer file (.lyrx) into a QGIS layer style (.qml).
River Architect’s mapping runs on QGIS print layouts (riverarchitect.mapping). Layer symbology moved with it: .lyrx -> .qml.
.lyrx is JSON (the Esri CIM format), so the class breaks, colours and labels of the published lifespan symbology can be carried over exactly rather than re-invented.
Supported colorizers
CIMRasterClassifyColorizer -> QGIS singlebandpseudocolor, DISCRETE interpolation CIMRasterUniqueValueColorizer -> QGIS paletted/unique values
Anything else is reported and skipped.
Usage
python -m riverarchitect.tools.lyrx2qml <input.lyrx> [output.qml]
Pure standard library - no QGIS, GDAL or arcpy needed.
- riverarchitect.tools.lyrx2qml.cim_color_to_rgba(color)[source]
Convert a CIM colour of any flavour into an (r, g, b, a) 0-255 tuple.
- riverarchitect.tools.lyrx2qml.build_pseudocolor_qml(colorizer)[source]
QGIS singlebandpseudocolor renderer from a CIMRasterClassifyColorizer.