Thank you for contributing to fimbox. We welcome bug fixes, documentation
improvements, new preprocessing modules, calibration routines, FIM
generation features, and most importantly we welcome new FIM model integration, tests, and usability improvements.
- Check existing issues and pull requests before starting work.
- For larger changes (new preprocessing step, new calibration routine, major refactor), please open an issue first so we can align on scope and approach.
- Keep changes focused. Small, well-scoped pull requests are much easier to review and merge.
fimbox requires Python 3.10 or newer (the package pins >=3.10,<3.13).
git clone https://github.com/sdmlua/fimbox.git
cd fimbox
pip install uv
uv venvActivate the virtual environment:
Mac / Linux
source .venv/bin/activateWindows (Command Prompt)
.venv\Scripts\activate.batWindows (PowerShell)
.venv\Scripts\Activate.ps1Then install the package:
uv pip install -e .
uv pip install -e ".[dev]"If you prefer Conda, create and activate the environment first, then run
the same uv pip install commands inside it.
The main locations in this repository are:
src/fimbox/preprocessing/download_data/— input data downloaders (DEM, NHD, NWM, FEMA NFHL, NLD, OSM bridges/roads, USGS gages).src/fimbox/preprocessing/calculate_branch/— the HAND production pipeline (BranchDerivation, BranchZero, CreateHAND, process_branches, calculate_allbranches).src/fimbox/preprocessing/calibrate_ratingcurve/— synthetic rating curve calibration (bankfull identification, channel/overbank subdivision, nonmonotonic adjustment, manual calibration).src/fimbox/fimgeneration/— flood inundation map generation (Inundator, BranchMosaic, FimGenerator).src/fimbox/_dask.py— shared Dask LocalCluster sized to the running machine.src/fimbox/_skip_if_valid.py— file-integrity-aware skip helper used throughout the preprocessing pipeline.config/— deny lists used by the outputs-cleanup step.tests/— test coverage for each subpackage.docs/— usage notebooks, images, and sample data.
- Follow the existing code style and naming patterns used in the relevant module.
- Any new or updated code must run within, and continue to support, the
full
fimboxpipeline —getAllInputData(input staging) through branch derivation/processing, calibration, and FIM generation. A change to one stage should not break the ones that consume its output; verify with an end-to-end test (e.g.tests/test_fimgeneration.pyortests/test_getallinputdata.py) before opening a pull request. - Format and lint with
ruffbefore committing:uv run ruff format . uv run ruff check --fix .
ruffis installed viauv pip install -e ".[dev]". CI/reviewers may reject pull requests that failruff checkor are notruff format-clean. - Add or update tests when changing behaviour.
tests/test_fimgeneration.pyis a good template for a real-AOI test: parameters live at the top of the file, the test is skipped automatically when the fixture isn't present. - If your change affects output filenames, raster dtypes, CSV columns, or directory structure, document it clearly in the pull request.
- Class-based modules use
@dataclassand arun()method (seeInundator,BranchMosaic,SrcBankfull). Match that pattern when adding new orchestrator classes. - Comments are plain
#. Avoid referencing external repositories inside docstrings unless the comment documents an algorithmic decision worth tracing.
Tests pass parameters at the top of each file so a developer can edit one constant to switch AOIs:
# tests/test_fimgeneration.py
AOI_DIR = Path("/Users/.../out/test_smallB")
N_WORKERS = 4Tests that need real AOI data are gated with
@pytest.mark.skipif(not (AOI_DIR / "branches").is_dir(), ...) so they
skip automatically when the fixture isn't present.
Always run pytest via python -m pytest, not the bare pytest command.
When conda is active alongside the uv venv, the shell resolves pytest to
conda's copy, which doesn't have fimbox installed and fails immediately.
python -m pytest uses whichever Python is first on PATH — the venv's
Python — so it always finds the installed package.
Mac / Linux
black .
python -m pytest tests/Windows
python -m pytest tests/Narrower test target while developing:
Mac / Linux
python -m pytest tests/test_fimgeneration.py -s
python -m pytest tests/test_branchprocessing.py::test_step_C25_calculate_allbranches_live_run -sWindows
python -m pytest tests/test_fimgeneration.py -s
python -m pytest tests/test_branchprocessing.py::test_step_C25_calculate_allbranches_live_run -sThe branch-processing live-run test (test_step_C25_*) is opt-in via
FIMBOX_RUN_ALLBRANCHES=1 because it can take 30+ minutes on a HUC8.
When your changes are ready:
- Create a feature branch from the latest main branch.
- Run
ruff format .andruff check --fix ., and confirm your change still runs through thefimboxpipeline end-to-end. - Commit your changes with a clear commit message.
- Open a pull request against
sdmlua/fimbox.
Please include the following in the pull request description:
- a short summary of what changed
- why the change is needed
- any testing you performed (
pytest tests/...) - any limitations, assumptions, or known follow-up work
If your pull request changes raster outputs, hydroTable columns, FIM generation behavior, or directory structure, sample output paths or screenshots are very helpful.
For bugs, please open an issue with:
- a short description of the problem
- steps to reproduce
- expected behavior
- relevant error messages or screenshots
- environment details such as OS, Python version, and package versions when relevant
For feature requests, please describe:
- the workflow or use case
- why the current behavior is limiting
- your proposed change, if you already have one in mind
For questions about contributing or project direction, please open an issue or contact:
- Sagy Cohen: sagy.cohen@ua.edu
- Supath Dhital: sdhital@ua.edu