Author: Tom Norman
The Pyromb (PR) library builds both RORB[1] and WBNM[2] model input files from ESRI shapefiles typically generated through a GIS package. This library's primary reason for existing is for use within the QGIS plugins Runoff Model: RORB and Runoff Model: WBNM
The library as it stands, is a minimal viable implementation of RORB and WBNM control files. It does however solve the primary issue with text file input models, that is, the need to manually transcribe information from GIS to the text file or graphical editor. Pyromb is now compatible with the RORB GE, therefore the generated control vector files can be easily modified for more complex catchments.
MiRORB is a similar more advance tool which uses the GIS package MapInfo. The unavailability of MiRORB for QGIS inspired this project. This library is not however GIS package dependent. Pyromb is a stand alone python package able to be used directly by a python application if necessary. The QGIS plugins developed in conjunction with this project only feeds the shapefiles to this library for processing. As such this library can be used for any GIS software package.
$ pip install pyromb
For MacOS or Linux, QGIS does not have its own python environment so PR can be installed through pip directly from the terminal by using the command above.
For Windows, QGIS has its own python environment. To install PR to work with QGIS, it needs to be installed via the OSGeo4W shell. Two methods depending on your version of QGIS, for newer versions,
- Open the OSGeo4W Shell (may need admin permission)
- Install via pip
$ pip install pyromb
If that fails, try:
- Open the OSGeo4W Shell (may need admin permission)
- Enter py3_env
- Install via pip
$ python -m pip install pyromb
- Install PR first
- Open QGIS Plugin Manager, search for Runoff Model: RORB and install
- Runoff Model: RORB is a processing plugin and is located in the processing toolbox under Runoff Model
PR uses four shapefiles to provide the necessary information to build the RORB and WBNM vector, these are detailed below. The attributes that must be present in the shapefile so that PR has can build the control files. The easiest way to ensure the necessary attributes are present is to use the example shapefiles in the data folder.
WARNING
the id fields must be globally unique between the reaches, confluences and centroids otherwise the catg file will not build correctly. This will be updated in subsequent releases.
Reaches are the connection between basins and confluences.
Type
Line geometry.
Attributes
'id' - The name of the reach [string].
's' - The slope of the reach (m/m) [double].
't' - The reach type. [integer].
Support
Type 1 reach only.
Notes
Reach length is derived from the shapefile geometry.
Centroids represent the basin attributes and are located as close to the basin centroid as possible, while still intersecting a reach.
Type
Point geometry
Attributes
'id' The name of the basin [string]
'fi' The fraction impervious
Support
Fraction impervious
Notes
Centroid to Basin matching is done through nearest neighbour. If a centroid is moved too far away from the basin’s true centroid, it may match with another basin, or not match at all.
Basins are only necessary to provide the centroid with an area. This was done to avoid having to transcribe area information into the Centroid shapefile as an attribute.
Type
Polygon geometry.
Attributes
None
Support
None
Notes
None
Confluences are the location where reaches meet, which isn't a centroid (no basin information associated).
Type
Point geometry
Attributes
'id' The name of the confluence [string]
'out' Flag whether this confluence is the outfall [integer]
If no outlet is set, building the catchment will fail. If more than one is set, the first confluence with this attribute set will be adopted as the outlet.
Support
Confluence Only
Notes
In the future, these will represent other features like storage.
- Basins are built in the preferred manner. There are various ways to produce the sub-catchments boundaries, please refer to your typical workflow to do so. These are nothing more than polygons that represent the boundaries of your subcatchments.
- Centroids are created from the basins, either using the in-built centroid tool in QGIS or estimating the location. Centroids represent a sub-area in the RORB Model. These don’t have the be at the centroid, these can be moved to suit the reaches.
- Confluences are manually located at junctions of reaches, these represent junction nodes in the RORB model and outlet locations in WBNM.
- Reach is the thalweg of the flow paths through the catchment. These are disjointed at each confluence and centroid, that is, they must start at an upstream confluence or centroid and end at the immediately downstream confluence or centroid.
- Out location, the outlet of the catchment must be explicitly nominated by setting the GIS attribute as 1. All other confluence should have this attribute set to 0.
An example of a built catchment can be found in the data folder.
Currently working on autogenerating the catchment diagram from an outlet location. That is, given an outlet location and DEM -> create subcatchment boundaries, reaches, centroids and confluences. The hope is that this will enable hydrographs to be generated very fast, with a high degree of scalability.