Giter VIP home page Giter VIP logo

pyromb's Introduction

Runoff Model Builder (pyromb)

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.

  1. https://www.harc.com.au/software/rorb/
  2. https://wbnm.com.au/

Installing

Dependencies

Numpy

Installing python package

$ pip install pyromb

Installing for the QGIS Runoff Model Builder plugin:

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,

  1. Open the OSGeo4W Shell (may need admin permission)
  2. Install via pip

$ pip install pyromb

If that fails, try:

  1. Open the OSGeo4W Shell (may need admin permission)
  2. Enter py3_env
  3. Install via pip

$ python -m pip install pyromb

Installing the QGIS Runoff Model Builder Plugin

  1. Install PR first
  2. Open QGIS Plugin Manager, search for Runoff Model: RORB and install
  3. Runoff Model: RORB is a processing plugin and is located in the processing toolbox under Runoff Model

Setting Up A Catchment

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

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

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 $\in[0,1]$ [decimal]
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

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

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.

Example Catchment

Catchment Overview

  1. 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.
  2. 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.
  3. Confluences are manually located at junctions of reaches, these represent junction nodes in the RORB model and outlet locations in WBNM.
  4. 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.
  5. 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.

Roadmap

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.

pyromb's People

Contributors

1234tom avatar norman-tom avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

pyromb's Issues

Checking for correct attribute names

The required attribute names should be checked, and a clear error reported back to the user indicating which attributes are missing from which shapefile.

GE support feature doesn't work well for v0.2.0

Hi Tom,

Just tested the plugin, but GE support feature doesn't work for me. The pyromb version has updated to 0.2, but it seems an error occurred:
A:\QGIS 3.28.5>pip install --upgrade pyromb Requirement already satisfied: pyromb in a:\qgis 3.28.5\apps\python39\lib\site-packages (0.1.0) Collecting pyromb Downloading pyromb-0.2.0-py3-none-any.whl.metadata (6.2 kB) Downloading pyromb-0.2.0-py3-none-any.whl (25 kB) Installing collected packages: pyromb Attempting uninstall: pyromb Found existing installation: pyromb 0.1.0 Uninstalling pyromb-0.1.0: Successfully uninstalled pyromb-0.1.0 Successfully installed pyromb-0.2.0 WARNING: There was an error checking the latest version of pip.

Not sure if it is the reason.
Thanks for your effort. I appreciate it.

Regard,
Theo

QGIS - Build RORB

After obtaining a .catg file from "Build RORB" in QGIS, I noticed that the areas of the subareas from the .catg file and the shp file, don't match. This is the same problem for the example files provided for Build RORB (QGIS). Why is this the case?

parsing empty gis attributes

When parsing empty gis attributes which are required to build the vector correctly does not throw an error and returns 'None' in the catchment vector which would cause errors in RORB.
example

ID fields are assumed to be unique

Pyromb assumes that the id field for reaches, confluences and centroids are globally unique. The dictionary that holds the ids to map these to an integer id required by RORB is shared across the three entities, therefore when these ids are not globally unique the order of connection is disrupted and RORB fails to build the catg file.

Solution is to use separate dictionaries, one for the reaches, confluences and centroids and only require unique ids within each dataset.

Can not install Plugin RORB Plugin

Hi Norman,

Thank you for developing plugin for RORB. However when I try to install the plugin, it gives the following error. Could you please help me to fix this. I am using QGIS version 3.22.4

image
Capture

Thank you and appreciate your help

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.