Standalone Usage¶
You can run ANUGA simulations outside of the Hydrata web platform using the run_anuga Python package. This is useful for:
- Local development and testing
- Running on your own HPC infrastructure
- Automating batch simulations
- CI/CD pipelines
Installation¶
Prerequisites¶
- Python 3.10+
- GDAL system libraries (
gdal-bin,libgdal-dev) - ANUGA (for running simulations)
Install run_anuga¶
# Clone the repository
git clone https://github.com/Hydrata/run_anuga.git
cd run_anuga
# Install in editable mode
pip install -e .
# With ANUGA support (required to actually run simulations)
pip install -e ".[anuga]"
# With development tools (pytest, ruff)
pip install -e ".[dev]"
Running a simulation¶
Using the CLI¶
With Hydrata server authentication (for progress reporting):
Using the Python API¶
Using MPI (parallel execution)¶
For large domains, run across multiple CPU cores:
Running the example¶
The repository includes an example package:
Note
The example includes a 200x200m DEM clipped from 1m elevation data sourced from the Geoscience Australia ELVIS portal (CC BY 4.0). See examples/australian_floodplain/LICENSE_DATA.md for attribution.
Inspecting outputs¶
After a run completes, outputs are in the outputs_* directory:
ls outputs_1_1_1/
# run_1_1_1.sww
# run_1_1_1_depth_max.tif
# run_1_1_1_velocity_max.tif
# run_1_1_1_depthIntegratedVelocity_max.tif
# run_1_1_1_stage_max.tif
# run_anuga_1.log
Open the GeoTIFF files in QGIS or any GIS software to visualise results.
Validating a package¶
Before running, you can validate a scenario.json against the schema:
from run_anuga.schema import validate_scenario
import json
with open("scenario.json") as f:
config = json.load(f)
validate_scenario(config)
print("Valid!")
Parsing inputs without running¶
To inspect a package without executing a simulation:
from run_anuga.run_utils import setup_input_data
input_data = setup_input_data("/path/to/package")
print(f"Project: {input_data['scenario_config']['project']}")
print(f"Duration: {input_data['scenario_config']['duration']}s")
print(f"EPSG: {input_data['scenario_config']['epsg']}")
print(f"Mesh file: {input_data['mesh_filepath']}")