Skip to main content

PyRASFile

A set of Python scripts designed to automatically produce and process key input and output files for HEC-RAS. Since HEC-RAS can run many flow profiles in parallel, this allows users to run HEC-RAS on large volumes of data with minimal manual intervention.

See main.py for example usage (the developer's actual usage) of both writing profiles and reading reports.

Writing Profiles

The profileWriter script can be used to generate a flow profiles file (.fxx) with any number of profiles and reaches and any set of flow volumes for each point. The buildFile function contains the main functionality and will build the complete contents of a flow file.

General Notes

Minor manual intervention is currently required if the output file is not named to match an existing set of flow data, as HEC-RAS will not be able to find it. In order to fix this, edit the .prj project file and add an entry for the new flow file in with the other flow file entries.

buildFile Inputs Summary

buildFile requires the following inputs:

  • nprofiles: the number of profiles to be generated
  • profiledata: the data on flows for each profile; see below.
  • bounddata: the data on boundary conditions; see below.
  • title and ver: the title for the flow profile and the version of HEC-RAS in use.
  • end: the data for the end of the file; this doesn't seem to require modification for steady flows, so this can typically be left as the default.

buildFile Input Details

profiledata

profileData needs to be in the form of a dictionary where the keys are a string specifying the river, reach, and station, and the values are a list of the flows for each profile. The key strings can be made using the helper function mkFlowHeader to ensure the correct format.

The number of flows for each entry in profiledata must be identical and equal to the number of profiles specified with nprofines.

bounddata

bounddata needs to be in the form of a dictionary where the keys are strings specifying the river and reach and the values are functions which will produce the appropriate boundary information given two arguments, the profile number and the flow rate (though these may often be ignored).

The keys should be in the format "river,reach".

The boundary data functions should return strings in the format used by mkBoundaryData, which accepts the arguments upname, dname, uparam, and dparam. upname and dname specify the type of boundary conditions, out of Known WS, Critical Depth, Normal Depth, and Junction. The two params need only be specified if the boundary conditions are Known WS, in which case they need to be a water depth appropriate to the flow rate, or Normal Depth, in which case they need to be a slope.

Reading Reports

After generating a HEC-RAS report, the parseFile function will parse the report file text to return a dictionary of values for all reaches and profiles. The convertCSV function will convert the report file into a CSV.

Metadata

Release files for pyrasfile 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyrasfile 1.0.0
File Size Uploaded
pyrasfile-1.0.0.tar.gz 14.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyrasfile 1.0.0
File Interpreter ABI Platform
pyrasfile-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 41.7 kB

Release files / pyrasfile-1.0.0.tar.gz

Download URL pyrasfile-1.0.0.tar.gz
Size 14.0 kB
Tags Source
SHA-256 checksum
How to use checksums
5e7e403f593a8b2f994f5e8f455839d7606900e8f4b0a2caa79c909c37a47001
BLAKE2b-256 checksum
How to use checksums
dfe6852ab1f5751918bf9b0ab92274d3a21a16cfd3eb4ae4ba45a1064819b49b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

Release files / pyrasfile-1.0.0-py3-none-any.whl

Download URL pyrasfile-1.0.0-py3-none-any.whl
Size 27.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
68d05f7a8c7ab743b22a92eacd4023c733cabf36acfd4a5f4990822452ac6c67
BLAKE2b-256 checksum
How to use checksums
54b12696ed345ca0dfd67dcb744f63af4ff841f18ab1f0e5556f381373e0d6e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release 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