ryan-tools is a collection of Python utilities for TUFLOW, RORB, 12D, GDAL, QGIS and general data-processing
workflows. Reusable code lives in ryan_library; files under ryan-scripts are human-facing wrappers and standalone
utilities.
The distribution is named ryan_functions, while maintained imports normally use ryan_library.
The repository targets Python 3.14. Maintained library code, orchestrators and unversioned wrappers follow the current repository standards; older standalone, versioned and compatibility files remain where they still support migration or narrow workflows.
Start with:
- Development guide for architecture, code categories, lifecycle terms and validation.
- Environment guide for Python, VS Code, installed-wheel and QGIS/OSGeo4W setup.
- Ryan Scripts guide for choosing and safely running scripts.
- Maintained wrapper standard when changing a library-backed wrapper.
- Project documentation index for setup guides, roadmaps and dated audits.
- Examples for direct library use when an existing wrapper is not the right fit.
ryan-tools/
|-- ryan_library/ # Maintained Python package
| |-- classes/ # Configuration, metadata and filename parsing
| |-- functions/ # Reusable algorithms and focused I/O helpers
| |-- orchestrators/ # Complete workflow controllers
| |-- processors/ # Stateful processors for supported result formats
| `-- scripts/ # Deprecated import-compatibility wrappers
|-- ryan-scripts/ # Human-facing wrappers and standalone utilities
|-- docs/ # Development guidance, plans and setup documentation
|-- examples/ # Example notebooks and supporting demonstrations
|-- repo-scripts/ # Build, environment and repository maintenance tools
|-- tests/ # Unit, integration and regression tests
| `-- test_data/ # Required synthetic test-data submodule
|-- vendor/
| `-- run_hy8/ # HY-8 submodule
|-- excel-resources/ # Excel workbook resources submodule
|-- qgis-resources/ # QGIS resources submodule
|-- unsorted/ # Separate holding-area submodule
|-- pyproject.toml # Package metadata and tool configuration
`-- setup.py # Setuptools hook that stages QGIS styles into wheels
This repository uses Git submodules and Git LFS for workbook resources. Install Git LFS, then clone recursively:
git lfs install
git clone --recurse-submodules https://github.com/Chain-Frost/ryan-tools.git
cd ryan-tools
git lfs pull
git -C qgis-resources lfs pull
git -C excel-resources lfs pullFor an existing clone:
git submodule update --init --recursive
git lfs pull
git -C qgis-resources lfs pull
git -C excel-resources lfs pullThe test suite requires tests/test_data; it does not download or substitute those fixtures automatically.
Install the repository requirements into the user's normal Python 3.14 installation. ryan-tools does not require or
assume that users know how to create or activate a virtual environment:
py -3.14 -m pip install --upgrade pip
py -3.14 repo-scripts\install_latest_wheel.py --dependencies-only
py -3.14 -m pip install -r requirements.txtrequirements.txt installs the checkout and development tools into that Python installation. Installing the project is
important when running wrappers copied outside the repository because they import the shared implementation from the
installed ryan_functions distribution. The dependency bootstrap installs binary Fiona, Rasterio and GDAL packages
from the configured geospatial wheel index, avoiding a local source build on Windows.
After changing ryan_library or package metadata, rebuild from the repository root:
python repo-scripts/build_library.pyThe build script updates the version in pyproject.toml and creates the wheel under dist/. Use --skip-pip when the
build dependency is already installed, or --skip-artifacts in an environment that cannot create or retain wheel
artifacts. Wheel builds require the QGIS resource submodule because setup.py stages the pinned TUFLOW QML styles into
the package.
Windows convenience entry points are:
.\package_and_install.bat
.\install-latest-wheel.batThe first builds and installs the package; the second installs the newest existing wheel.
Use focused pytest commands for a bounded change. Keep temporary files under the repository on this Windows checkout:
python -m pytest tests\path\to\test_file.py --basetemp=.pytest_cache\basetempRun the complete suite through the repository runner:
cmd.exe /C repo-scripts\run_tests.batThe runner configures the source and bundled HY-8 import paths, uses a repository-local base temporary directory and generates terminal, HTML and XML coverage reports. See the development guide for proportional validation expectations.
| Need | Start here |
|---|---|
| Run or adapt a human-facing script | ryan-scripts/README.md |
| Process TUFLOW results with maintained wrappers | ryan-scripts/TUFLOW-python/README.md |
| Extend the TUFLOW processor framework | ryan_library/processors/tuflow/README.md |
| Use reusable Python APIs directly | examples/README.md |
| Run maintained GDAL workflows | ryan-scripts/gdal-python/README.md |
| Map a remaining legacy GDAL BAT file to its replacement | ryan-scripts/gdal-bat/README.md |
| Connect the repository MCP server | docs/MCP_SETUP.md |
TuflowStringParser extracts the configured data type and run metadata from a result path:
from pathlib import Path
from ryan_library.classes.tuflow_string_classes import TuflowStringParser
parser = TuflowStringParser(Path("M11_01p_00120m_TP01_1d_Q.csv"))
print(parser.data_type)
print(parser.raw_run_code)
print(parser.clean_run_code)
print(parser.aep)
print(parser.duration)
print(parser.tp)The authoritative suffix registry is
ryan_library/classes/tuflow_results_validation_and_datatypes.json.
It contains both processor-backed tabular types and raster classifications used for discovery.
load_tuflow_data() handles discovery, logging, serial or parallel processing and optional location filtering:
from ryan_library.functions.tuflow.notebook_helpers import load_tuflow_data
collection = load_tuflow_data(
paths=["results"],
data_types=["Q", "V", "H", "Nmx", "Cmx", "Chan", "EOF"],
parallel=True,
locations=["Culvert_01"],
)
timeseries = collection.combine_1d_timeseries()
maximums = collection.combine_1d_maximums()Processor-backed types currently include POMM, PO, Cmx, Nmx, Chan, ccA, RLL_Qmx, Q, H, CF,
V, EOF and TLF. Use the processor development notes for combination behavior, caching and extension guidance.
Orchestrators are callable workflow controllers; wrappers add editable defaults, CLI handling, banners, exit codes and optional pauses:
from pathlib import Path
from ryan_library.orchestrators.tuflow.tuflow_culverts_merge import main_processing
main_processing(
paths_to_process=[Path("results")],
include_data_types=["Nmx", "Cmx", "Chan", "ccA", "RLL_Qmx", "EOF"],
locations_to_include=["Culvert_01"],
output_dir=Path("outputs"),
export_mode="both",
)Representative orchestrators cover culvert maximums and time series, PO/POMM combination, closure durations, peak and
stability checks, TUFLOW log summaries and result styling. The corresponding maintained wrappers are under
ryan-scripts/TUFLOW-python; use that folder's README and each wrapper's --help output as the current interface.
RORB hydrograph discovery and parsing:
from pathlib import Path
from ryan_library.functions.RORB.read_rorb_files import find_batch_files, parse_batch_output
batch_files = find_batch_files([Path("rorb_outputs")])
runs = [parse_batch_output(path) for path in batch_files]12D culvert export processing:
from pathlib import Path
from ryan_library.functions.process_12D_culverts import get_combined_df_from_files
culverts = get_combined_df_from_files(Path("12d_exports"))For GDAL raster conversion, mosaics, flood extents, footprints, metadata and point-cloud conversion, use the
maintained GDAL Python wrappers. The BAT files that remain under
ryan-scripts/gdal-bat are legacy migration references and should not be selected for new work.
The resource submodules contain project templates and application assets:
excel-resources/workbooks/: Excel templates for hydrology, frequency and culvert workflows.qgis-resources/processing-models/tuflow/: QGIS models for common TUFLOW input layers.qgis-resources/processing-models/tuflow/supporting-workbooks/: formula-driven supporting workbooks used by relevant models.qgis-resources/styles/: QML styles, QPT layouts and supporting spatial assets.qgis-resources/scripts/: QGIS Python console and PyQGIS utilities.
Except for the TUFLOW QML files staged into wheel builds, treat these resources as project templates rather than files installed with the Python package. The parent repository pins each submodule to a reviewed commit.
- Pull request template records summaries, validation and review checklists.
- Code-review instructions describe repository-specific review expectations.
- Development guide is the canonical architecture and validation reference.
- MCP setup documents the repository's read-only discovery and inspection tools for AI clients.