quantum-dan / raspy

Python interface for HEC-RAS.
41 stars 4 forks source link

raspy

Python interface for HEC-RAS. RAS + Python = raspy.

This can be installed on pip/PyPI as raspy-auto.

See PyRAS and the paper "Application of Python Scripting Techniques for Control and Automation of HEC-RAS Simulations" for similar ideas.

Related packages:

HEC-RAS Versions

It is now straightforwardly possible to specify different HEC-RAS versions when creating a Ras object. There is now a second, optional argument which specifying a HEC-RAS version string, which is the version number with no periods. The default is "507", specifying HEC-RAS 5.0.7. To use the current default download as of this writing, 6.3.1, use Ras(projectPath, "631"). I have not extensively tested this with HEC-RAS 6, but a few methods I did test still work; open an Issue if one does not.

Updates and Maintenance

If extended functionality would be useful, open an Issue and I will look into making updates.

Usage

Raspy is intended to be used through an API object, which provides a uniform way to access functionality. The argument to the API class is a Ras object, which by default is from the Ras module but could come from another library as long as compatible functionality is provided (requirements are documented in a comment at the top of api.py). By default, a Ras object is created with a project path to a prepared HEC-RAS project, which must have geometry set up, a flow file to write to, etc. The assumption is that the desired plan (pointing to the correct flow file and geometry) is already open in that project, but API.ops.setPlan can set a plan file.

Core functionality is built and tested for steady-state models. I may be able to implement some simplistic unsteady-state functionality on request.

The API object contains three other objects: ops, which contains operations functionality (e.g. opening, closing, running); params, which contains functionality to set parameters (e.g. roughness, flow profiles); and data, which contains data retrieval functionality. The methods and arguments of those are hopefully fairly self-explanatory, but a few important ones are highlighted here.

Dependencies

Functionality

Raspy does or will implement the following functionality. Functionality is not yet implemented unless it is marked as such in the list below. Functionality is implemented through the HEC-RAS API where possible, or failing that through the direct manipulation of HEC-RAS files (as in PyRASFile).

HEC-RAS Interface

That is, what HEC-RAS interactions will be supported.

Combined, this set of capabilities permits fully automated use of HEC-RAS once geometry has been specified, which can be used to support calibration as well as other applications (e.g. testing a wide range of flow inputs).

Raspy External Interfaces

If there is need for it (open an Issue), I should be able to fairly quickly implement an R interface (through Reticulate) or a plain text config file-based mechanism for using Raspy. Currently, Raspy can only be used as a Python module.

Current Applications

Raspy is currently used by two other HEC-RAS automation tools.