Skip to main content

A collection of HEC-RAS file writers and parsers

Project description

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.

Project details


Download files

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

Source Distribution

pyrasfile-1.0.0.tar.gz (14.0 kB view details)

Uploaded Source

Built Distribution

pyrasfile-1.0.0-py3-none-any.whl (27.7 kB view details)

Uploaded Python 3

File details

Details for the file pyrasfile-1.0.0.tar.gz.

File metadata

  • Download URL: pyrasfile-1.0.0.tar.gz
  • Upload date:
  • Size: 14.0 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for pyrasfile-1.0.0.tar.gz
Algorithm Hash digest
SHA256 5e7e403f593a8b2f994f5e8f455839d7606900e8f4b0a2caa79c909c37a47001
MD5 230a34eba1d23a2ff79bd0b223e748ec
BLAKE2b-256 dfe6852ab1f5751918bf9b0ab92274d3a21a16cfd3eb4ae4ba45a1064819b49b

See more details on using hashes here.

File details

Details for the file pyrasfile-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: pyrasfile-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 27.7 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for pyrasfile-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 68d05f7a8c7ab743b22a92eacd4023c733cabf36acfd4a5f4990822452ac6c67
MD5 c059d9829c4d924062da7e538931f5a1
BLAKE2b-256 54b12696ed345ca0dfd67dcb744f63af4ff841f18ab1f0e5556f381373e0d6e0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page