Skip to main content

PyTuflow

PyTUFLOW is a library that acts as an API for your TUFLOW model. It allows easy interaction with the model results, contains a number of useful utilities for building TUFLOW models, and contains some useful parsers for files within the TUFLOW eco-system.

Documentation

The documentation for PyTUFLOW can be found at: https://docs.tuflow.com/pytuflow/

Installation

You can install PyTUFLOW using pip.

pip install pytuflow

Dependencies

Most dependencies are automatically installed when you install pytuflow. There are a few additional dependencies that are not automatically installed, but are very useful as they will extend the functionality of pytuflow. These are:

  • netCDF4: This is required for reading any netCDF files, for example, the NC time-series output format, or the NC map output format. It also allows for reading of the XMDF header information.
  • GDAL: This is required for reading GIS files, which extends the :class:GisInput<pytuflow.GisInput> class and allows the use of GIS files as locations to extract data from map outputs.
  • shapely: Needed for extracting section data from map output formats.
  • QGIS: Currently QGIS is required for extracting data from XMDF, NCMesh, and CATCHJson output formats. We hope to remove this dependency in the future, but for now, it is required for these particular output formats. It isn't required for using pytuflow in general.

One of the trickiest libraries to install is GDAL. For Windows, you can download pre-compiled binaries from here: https://github.com/cgohlke/geospatial-wheels/releases.

For QGIS, there are some broad instructions on how to set up a QGIS environment in the output examples.

Quickstart

The best place to get started is the Load and Run a TUFLOW Model example, or to browse through the other Examples.

Development

The code base can be cloned from GitHub:

git clone https://github.com/TUFLOW-Support/PyTuflow.git --recurse-submodules

Dependencies can be installed using the requirements-dev.txt file:

pip install -r requirements-dev.txt

GDAL python bindings will also need to be installed separately. Version 3.8 or later is preferred.

Building the Docs

To build the documentation, navigate to the docs folder and run:

# from the pytuflow project root directory
cd docs
.\make.bat dirhtml

To serve the documentation locally, you can use (on Windows):

.\serve.ps1

Running Tests

PyTUFLOW uses unittest and pytest for testing depending on which module is being tested.

To run tests for the time series output classes:

# from the pytuflow project root directory
python -m unittest tests.test_time_series

To run tests for the map output classes, you will need to run within a QGIS Python environment:

# from the pytuflow project root directory
python -m unittest tests.test_map_output

To run the tmf tests on Windows:

# from the pytuflow project root directory
cd pytuflow/_tmf
pytest tests/unit_tests/

To run the fm_to_estry unit tests:

# from the pytuflow project root directory
cd pytuflow/_fm_to_estry
python -m unittest discover -s tests/unit_tests

To run the fm_to_estry integration tests:

# from the pytuflow project root directory
cd pytuflow/_fm_to_estry
python -m unittest discover -s tests/integration_tests

Building the Package

# from the pytuflow project root directory
python -m build --wheel

LICENCE

MIT LICENCE (see LICENSE file for details).

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytuflow-1.2.1-py3-none-any.whl (808.5 kB view details)

Uploaded Python 3

File details

Details for the file pytuflow-1.2.1-py3-none-any.whl.

File metadata

  • Download URL: pytuflow-1.2.1-py3-none-any.whl
  • Upload date:
  • Size: 808.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.4

File hashes

Hashes for pytuflow-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 35b691a28e0208f28a8b73b0ab82ba2a3edb936fcfd36f9056003878d262a993
MD5 7053d5498fd00bbbf0fbc6a9bc4c5152
BLAKE2b-256 cacb00f976a2e4984bda77518f28b2235edaa70bba7680a316aac2011cbf51f6

See more details on using hashes here.

Release history Release notifications | RSS feed

1.2.2

1 file

This release

1.2.1 This release

1 file

1.2

1 file

1.1.10

1 file

1.1.9

1 file

1.1.8

1 file

1.1.7

1 file

1.1.6

1 file

1.1.5

1 file

1.1.4

1 file

1.1.3

1 file

1.1.2

1 file

1.1.1

1 file

1.1.0

1 file

1.0.4

1 file

1.0.3

1 file

1.0.2

1 file

1.0.1

1 file

1.0.0

1 file

0.0.17

1 file

0.0.16

1 file

0.0.15

1 file

0.0.14

1 file

0.0.13

1 file

0.0.12

2 files

0.0.11

2 files

0.0.10

2 files

0.0.9

2 files

0.0.8

2 files

0.0.7

2 files

0.0.5

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page