ras-commander 0.52.0__tar.gz → 0.53.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ras_commander-0.52.0/ras_commander.egg-info → ras_commander-0.53.0}/PKG-INFO +92 -49
- {ras_commander-0.52.0 → ras_commander-0.53.0}/README.md +91 -48
- {ras_commander-0.52.0 → ras_commander-0.53.0}/ras_commander/Decorators.py +137 -127
- {ras_commander-0.52.0 → ras_commander-0.53.0}/ras_commander/HdfBase.py +21 -6
- {ras_commander-0.52.0 → ras_commander-0.53.0}/ras_commander/HdfFluvialPluvial.py +553 -553
- ras_commander-0.53.0/ras_commander/HdfResultsPlan.py +365 -0
- {ras_commander-0.52.0 → ras_commander-0.53.0}/ras_commander/HdfStruc.py +1 -1
- {ras_commander-0.52.0 → ras_commander-0.53.0}/ras_commander/HdfXsec.py +2 -2
- {ras_commander-0.52.0 → ras_commander-0.53.0}/ras_commander/LoggingConfig.py +2 -1
- {ras_commander-0.52.0 → ras_commander-0.53.0}/ras_commander/RasCmdr.py +45 -20
- {ras_commander-0.52.0 → ras_commander-0.53.0}/ras_commander/RasPlan.py +74 -65
- {ras_commander-0.52.0 → ras_commander-0.53.0}/ras_commander/RasPrj.py +934 -917
- {ras_commander-0.52.0 → ras_commander-0.53.0}/ras_commander/RasUnsteady.py +38 -19
- {ras_commander-0.52.0 → ras_commander-0.53.0/ras_commander.egg-info}/PKG-INFO +92 -49
- {ras_commander-0.52.0 → ras_commander-0.53.0}/setup.py +1 -1
- ras_commander-0.52.0/ras_commander/HdfResultsPlan.py +0 -257
- {ras_commander-0.52.0 → ras_commander-0.53.0}/LICENSE +0 -0
- {ras_commander-0.52.0 → ras_commander-0.53.0}/pyproject.toml +0 -0
- {ras_commander-0.52.0 → ras_commander-0.53.0}/ras_commander/HdfBndry.py +0 -0
- {ras_commander-0.52.0 → ras_commander-0.53.0}/ras_commander/HdfInfiltration.py +0 -0
- {ras_commander-0.52.0 → ras_commander-0.53.0}/ras_commander/HdfMesh.py +0 -0
- {ras_commander-0.52.0 → ras_commander-0.53.0}/ras_commander/HdfPipe.py +0 -0
- {ras_commander-0.52.0 → ras_commander-0.53.0}/ras_commander/HdfPlan.py +0 -0
- {ras_commander-0.52.0 → ras_commander-0.53.0}/ras_commander/HdfPlot.py +0 -0
- {ras_commander-0.52.0 → ras_commander-0.53.0}/ras_commander/HdfPump.py +0 -0
- {ras_commander-0.52.0 → ras_commander-0.53.0}/ras_commander/HdfResultsMesh.py +0 -0
- {ras_commander-0.52.0 → ras_commander-0.53.0}/ras_commander/HdfResultsPlot.py +0 -0
- {ras_commander-0.52.0 → ras_commander-0.53.0}/ras_commander/HdfResultsXsec.py +0 -0
- {ras_commander-0.52.0 → ras_commander-0.53.0}/ras_commander/HdfUtils.py +0 -0
- {ras_commander-0.52.0 → ras_commander-0.53.0}/ras_commander/RasExamples.py +0 -0
- {ras_commander-0.52.0 → ras_commander-0.53.0}/ras_commander/RasGeo.py +0 -0
- {ras_commander-0.52.0 → ras_commander-0.53.0}/ras_commander/RasGpt.py +0 -0
- {ras_commander-0.52.0 → ras_commander-0.53.0}/ras_commander/RasMapper.py +0 -0
- {ras_commander-0.52.0 → ras_commander-0.53.0}/ras_commander/RasToGo.py +0 -0
- {ras_commander-0.52.0 → ras_commander-0.53.0}/ras_commander/RasUtils.py +0 -0
- {ras_commander-0.52.0 → ras_commander-0.53.0}/ras_commander/__init__.py +0 -0
- {ras_commander-0.52.0 → ras_commander-0.53.0}/ras_commander.egg-info/SOURCES.txt +0 -0
- {ras_commander-0.52.0 → ras_commander-0.53.0}/ras_commander.egg-info/dependency_links.txt +0 -0
- {ras_commander-0.52.0 → ras_commander-0.53.0}/ras_commander.egg-info/top_level.txt +0 -0
- {ras_commander-0.52.0 → ras_commander-0.53.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: ras-commander
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.53.0
|
4
4
|
Summary: A Python library for automating HEC-RAS operations
|
5
5
|
Home-page: https://github.com/billk-FM/ras-commander
|
6
6
|
Author: William M. Katzenmeyer
|
@@ -18,7 +18,7 @@ Dynamic: summary
|
|
18
18
|
|
19
19
|
# RAS Commander (ras-commander)
|
20
20
|
|
21
|
-
RAS Commander is a Python library for automating HEC-RAS operations, providing a set of tools to interact with HEC-RAS project files, execute simulations, and manage project data. This library
|
21
|
+
RAS Commander is a Python library for automating HEC-RAS operations, providing a set of tools to interact with HEC-RAS project files, execute simulations, and manage project data. This library was initially conceptualized in the Australian Water School course "AI Tools for Modelling Innovation", and subsequently expanded to cover the basic functionality of the HECRASController COM32 interface using open-source python libraries. This library uses a Test Driven Development strategy, leveraging the publicly-available HEC-RAS Example projects to create repeatable demonstration examples. The "Commmander" moniker is inspired by the "Command Line is All You Need" approach to HEC-RAS automation that was first implemented in the HEC-Commander Tools repository.
|
22
22
|
|
23
23
|
## Contributors:
|
24
24
|
William Katzenmeyer, P.E., C.F.M.
|
@@ -29,9 +29,17 @@ Aaron Nichols, P.E., C.F.M.
|
|
29
29
|
|
30
30
|
(Additional Contributors Here)
|
31
31
|
|
32
|
-
## Don't Ask Me, Ask ChatGPT!
|
32
|
+
## Don't Ask Me, Ask ChatGPT!
|
33
33
|
|
34
|
-
|
34
|
+
This repository has several methods of interaction with Large Language Models and LLM-Assisted Coding built right in:
|
35
|
+
|
36
|
+
1. **[RAS Commander Library Assistant GPT](https://chatgpt.com/g/g-TZRPR3oAO-ras-commander-library-assistant)**: A specialized GPT model with access to the ras-commander codebase and library, available for answering queries and providing code suggestions. You can even upload your own plan, unsteady and HDF files to inspect and help determine how to automate your workflows or visualize your results, although this ability is still limited by OpenAI's GPT frameworks and may not be useful for long conversations.
|
37
|
+
|
38
|
+
2. **[Purpose-Built Knowledge Base Summaries](https://github.com/billk-FM/ras-commander/tree/main/ai_tools/assistant_knowledge_bases)**: Up-to-date compilations of the documentation and codebase for use with large language models like Claude or GPT-4. Look in 'ai_tools/assistant_knowledge_bases/' in the repo. The repo's codebase (without documentation and examples) has been curated to stay within the current ~200k context window limitations of frontier models, and for tasks that do not need an understanding of the underlying code, the Comprehensive Library Guide and any relevant examples from the example folder should be adequate context for leveraging the ras-commander API to complete tasks.
|
39
|
+
|
40
|
+
3. **[Cursor IDE Integration](https://github.com/billk-FM/ras-commander/blob/main/.cursorrules)**: Custom rules(.cursorrules) for the Cursor IDE to provide context-aware suggestions and documentation. Just open the repository folder in Cursor to recognize these instructions. You can create your own folders "/workspace/, "/projects/", or "my_projects/" as these are already in the .gitignore, and place your custom scripts there for your projects. This will allow easy referencing of the ras-commander documents and individual repo files, the automatic loading of the .cursorrules file. Alternatvely, download the github repo into your projects folder to easily load documents and use cursor rules files.
|
41
|
+
|
42
|
+
5. **[RAS-Commander Library Assistant](https://github.com/billk-FM/ras-commander/blob/main/library_assistant)**: A full-featured interface for multi-turn conversations, using your own API keys and the ras-commander library for context. The library assistant allows you to load your own scripts and chat with specific examples and/or function classes in the RAS-Commander library to effectively utilize the library's functions in your workflow. To reduce hallucinations, a file browser is included which adds full files to the conversation to ensure grounded responses. A dashboard shows you the total context and estimated cost of each request. **Now with support for OpenAI's o1 and o3-mini, and Deepseek V3 and R1 models using US-based Together.ai**
|
35
43
|
|
36
44
|
|
37
45
|
## Background
|
@@ -39,65 +47,90 @@ The ras-commander library emerged from the initial test-bed of AI-driven coding
|
|
39
47
|
|
40
48
|
## Features
|
41
49
|
|
42
|
-
|
43
|
-
- Support for both single and multiple project instances
|
44
|
-
- Parallel execution of HEC-RAS plans
|
45
|
-
- Utilities for managing geometry, plan, and unsteady flow files
|
46
|
-
- Example project management for testing and development
|
47
|
-
- Two primary operation modes: "Run Missing" and "Build from DSS"
|
48
|
-
|
49
|
-
## AI-Driven Coding Experience
|
50
|
+
If you've ever read the book "Breaking the HEC-RAS Code" by Chris Goodell, this library is intended to be an AI-coded, pythonic library that provides a modern alternative to the HECRASController API. By leveraginging modern python features libraries such as pandas, geopandas and H5Py (favoring HDF data sources wherever practicable) this library builds functionality around HEC-RAS 6.2+ while maintaining as much forward compatibilty as possible with HEC-RAS 2025.
|
50
51
|
|
51
|
-
|
52
|
+
HEC-RAS Project Management & Execution
|
53
|
+
- Multi-project handling with parallel and sequential execution
|
54
|
+
- Command-line execution integration
|
55
|
+
- Project folder management and organization
|
56
|
+
- Multi-core processing optimization
|
57
|
+
- Progress tracking and logging
|
58
|
+
- Execution error handling and recovery
|
52
59
|
|
53
|
-
1. **ChatGPT Assistant: [RAS Commander Library Assistant](https://chatgpt.com/g/g-TZRPR3oAO-ras-commander-library-assistant)**: A specialized GPT model trained on the ras-commander codebase, available for answering queries and providing code suggestions.
|
54
60
|
|
55
|
-
|
61
|
+
|
62
|
+
HDF Data Access & Analysis
|
63
|
+
- 2D mesh results processing (depths, velocities, WSE)
|
64
|
+
- Cross-section data extraction
|
65
|
+
- Boundary condition analysis
|
66
|
+
- Structure data (bridges, culverts, gates)
|
67
|
+
- Pipe network and pump station analysis
|
68
|
+
- Fluvial-pluvial boundary calculations
|
69
|
+
- Infiltration and precipitation data handling
|
56
70
|
|
57
|
-
|
58
|
-
|
71
|
+
|
72
|
+
RAS ASCII File Operations
|
73
|
+
- Plan file creation and modification
|
74
|
+
- Geometry file parsing examples
|
75
|
+
- Unsteady flow file management
|
76
|
+
- Project file updates and validation
|
59
77
|
|
78
|
+
Note about support for Pipe Networks: As a relatively new feature, only read access to Pipe Network geometry and results data has been included. Users will need to code their own methods to modify/add pipe network data, and pull requests are always welcome to incorporate this capability. Please note that the library has not been tested with versions prior to HEC-RAS 6.2.
|
60
79
|
|
61
80
|
## Installation
|
62
81
|
|
63
|
-
|
82
|
+
First, create a virtual environment with conda or venv (ask ChatGPT if you need help).
|
83
|
+
|
84
|
+
#### Install via Pip
|
64
85
|
|
65
86
|
In your virtual environment, install ras-commander using pip:
|
66
87
|
```
|
67
88
|
pip install h5py numpy pandas requests tqdm scipy xarray geopandas matplotlib ras-commander ipython tqdm psutil shapely fiona pathlib rtree rasterstats
|
68
89
|
pip install --upgrade ras-commander
|
69
90
|
```
|
70
|
-
|
71
|
-
**Tested with Python 3.11**
|
72
|
-
|
73
|
-
|
74
91
|
If you have dependency issues with pip (especially if you have errors with numpy), try clearing your local pip packages 'C:\Users\your_username\AppData\Roaming\Python\' and then creating a new virtual environment.
|
75
92
|
|
93
|
+
#### Work in a Local Copy
|
94
|
+
|
95
|
+
If you want to make revisions and work actively in your local version of ras-commander, just skip the pip install rascommander step above and clone a fork of the repo to your local machine using Git (ask ChatGPT if you need help). Most of the notebooks and examples in this repo have a code segment similar to the one below, that works as long as the script is located in a first-level subfolder of the ras-commander repository:
|
96
|
+
```
|
97
|
+
# Flexible imports to allow for development without installation
|
98
|
+
try:
|
99
|
+
# Try to import from the installed package
|
100
|
+
from ras_commander import init_ras_project, RasExamples, RasCmdr, RasPlan, RasGeo, RasUnsteady, RasUtils, ras
|
101
|
+
except ImportError:
|
102
|
+
# If the import fails, add the parent directory to the Python path
|
103
|
+
current_file = Path(__file__).resolve()
|
104
|
+
parent_directory = current_file.parent.parent
|
105
|
+
sys.path.append(str(parent_directory))
|
106
|
+
# Alternately, you can just define a path sys.path.append(r"c:/path/to/rascommander/rascommander)")
|
107
|
+
|
108
|
+
# Now try to import again
|
109
|
+
from ras_commander import init_ras_project, RasExamples, RasCmdr, RasPlan, RasGeo, RasUnsteady, RasUtils, ras
|
110
|
+
```
|
111
|
+
It is highly suggested to fork this repository before going this route, and using Git to manage your changes! This allows any revisions to the ras-commander classes and functions to be actively edited and developed by end users. The folders "/workspace/, "/projects/", or "my_projects/" are included in the .gitignore, so users can place you custom scripts there for any project data they don't want to be tracked by git.
|
112
|
+
|
76
113
|
|
77
|
-
## Requirements
|
78
114
|
|
79
|
-
|
80
|
-
- HEC-RAS 6.2 or later (other versions may work, all testing was done with version 6.2 and above)
|
81
|
-
- Detailed project workflows and/or existing libraries and code where ras-commander can be integrated.
|
115
|
+
|
82
116
|
|
83
|
-
|
117
|
+
## Quick Start Guide
|
84
118
|
|
85
|
-
## Quick Start
|
86
119
|
```
|
87
120
|
from ras_commander import init_ras_project, RasCmdr, RasPlan
|
88
121
|
```
|
89
122
|
|
90
|
-
|
123
|
+
### Initialize a project
|
91
124
|
```
|
92
125
|
init_ras_project(r"/path/to/project", "6.5")
|
93
126
|
```
|
94
127
|
|
95
|
-
|
128
|
+
### Execute a single plan
|
96
129
|
```
|
97
130
|
RasCmdr.compute_plan("01", dest_folder=r"/path/to/results", overwrite_dest=True)
|
98
131
|
```
|
99
132
|
|
100
|
-
|
133
|
+
### Execute plans in parallel
|
101
134
|
```
|
102
135
|
results = RasCmdr.compute_parallel(
|
103
136
|
plan_numbers=["01", "02"],
|
@@ -108,14 +141,14 @@ results = RasCmdr.compute_parallel(
|
|
108
141
|
)
|
109
142
|
```
|
110
143
|
|
111
|
-
|
144
|
+
### Modify a plan
|
112
145
|
```
|
113
146
|
RasPlan.set_geom("01", "02")
|
114
147
|
```
|
115
148
|
|
116
149
|
Certainly! I'll provide you with an updated Key Components section and Project Organization diagram based on the current structure of the ras-commander library.
|
117
150
|
|
118
|
-
|
151
|
+
#### Key Components
|
119
152
|
|
120
153
|
- `RasPrj`: Manages HEC-RAS projects, handling initialization and data loading
|
121
154
|
- `RasCmdr`: Handles execution of HEC-RAS simulations
|
@@ -125,7 +158,7 @@ Certainly! I'll provide you with an updated Key Components section and Project O
|
|
125
158
|
- `RasUtils`: Contains utility functions for file operations and data management
|
126
159
|
- `RasExamples`: Manages and loads HEC-RAS example projects
|
127
160
|
|
128
|
-
|
161
|
+
#### New Components:
|
129
162
|
- `HdfBase`: Core functionality for HDF file operations
|
130
163
|
- `HdfBndry`: Enhanced boundary condition handling
|
131
164
|
- `HdfMesh`: Comprehensive mesh data management
|
@@ -141,9 +174,9 @@ Certainly! I'll provide you with an updated Key Components section and Project O
|
|
141
174
|
- `RasToGo`: Go-Consequences integration
|
142
175
|
- `HdfPlot` & `HdfResultsPlot`: Specialized plotting utilities
|
143
176
|
|
144
|
-
|
177
|
+
### Project Organization Diagram
|
145
178
|
|
146
|
-
|
179
|
+
### Project Organization Diagram
|
147
180
|
|
148
181
|
```
|
149
182
|
ras_commander
|
@@ -206,7 +239,7 @@ ras_commander
|
|
206
239
|
└── requirements.txt
|
207
240
|
```
|
208
241
|
|
209
|
-
|
242
|
+
### Accessing HEC Examples through RasExamples
|
210
243
|
|
211
244
|
The `RasExamples` class provides functionality for quickly loading and managing HEC-RAS example projects. This is particularly useful for testing and development purposes.
|
212
245
|
|
@@ -227,7 +260,7 @@ projects = ras_examples.list_projects("Steady Flow")
|
|
227
260
|
extracted_paths = ras_examples.extract_project(["Bald Eagle Creek", "Muncie"])
|
228
261
|
```
|
229
262
|
|
230
|
-
|
263
|
+
### RasPrj
|
231
264
|
|
232
265
|
The `RasPrj` class is central to managing HEC-RAS projects within the ras-commander library. It handles project initialization, data loading, and provides access to project components.
|
233
266
|
|
@@ -243,18 +276,18 @@ Example usage:
|
|
243
276
|
from ras_commander import RasPrj, init_ras_project
|
244
277
|
```
|
245
278
|
|
246
|
-
|
279
|
+
#### Using the global ras object
|
247
280
|
```
|
248
281
|
init_ras_project("/path/to/project", "6.5")
|
249
282
|
```
|
250
283
|
|
251
|
-
|
284
|
+
#### Creating a custom RasPrj instance
|
252
285
|
```
|
253
286
|
custom_project = RasPrj()
|
254
287
|
init_ras_project("/path/to/another_project", "6.5", ras_instance=custom_project)
|
255
288
|
```
|
256
289
|
|
257
|
-
|
290
|
+
### RasHdf
|
258
291
|
|
259
292
|
The `RasHdf` class provides utilities for working with HDF files in HEC-RAS projects, enabling easy access to simulation results and model data.
|
260
293
|
|
@@ -275,7 +308,7 @@ print(runtime_data)
|
|
275
308
|
This class simplifies the process of extracting and analyzing data from HEC-RAS HDF output files, supporting tasks such as post-processing and result visualization.
|
276
309
|
|
277
310
|
|
278
|
-
|
311
|
+
#### Infrastructure Analysis
|
279
312
|
```python
|
280
313
|
from ras_commander import HdfPipe, HdfPump
|
281
314
|
|
@@ -288,7 +321,7 @@ pump_stations = HdfPump.get_pump_stations(hdf_path)
|
|
288
321
|
pump_performance = HdfPump.get_pump_station_summary(hdf_path)
|
289
322
|
```
|
290
323
|
|
291
|
-
|
324
|
+
#### Advanced Results Analysis
|
292
325
|
```python
|
293
326
|
from ras_commander import HdfResultsMesh
|
294
327
|
|
@@ -301,7 +334,7 @@ from ras_commander import HdfResultsPlot
|
|
301
334
|
HdfResultsPlot.plot_results_max_wsel(max_ws)
|
302
335
|
```
|
303
336
|
|
304
|
-
|
337
|
+
#### Fluvial-Pluvial Analysis
|
305
338
|
```python
|
306
339
|
from ras_commander import HdfFluvialPluvial
|
307
340
|
|
@@ -309,7 +342,7 @@ boundary = HdfFluvialPluvial.calculate_fluvial_pluvial_boundary(
|
|
309
342
|
hdf_path,
|
310
343
|
delta_t=12 # Time threshold in hours
|
311
344
|
)
|
312
|
-
|
345
|
+
```
|
313
346
|
|
314
347
|
## Documentation
|
315
348
|
|
@@ -324,7 +357,6 @@ Check out the `examples/` directory for sample scripts demonstrating various fea
|
|
324
357
|
The ras-commander library is an ongoing project. Future plans include:
|
325
358
|
- Integration of more advanced AI-driven features
|
326
359
|
- Expansion of HMS and DSS functionalities
|
327
|
-
- Enhanced GPU support for computational tasks
|
328
360
|
- Community-driven development of new modules and features
|
329
361
|
|
330
362
|
## Related Resources
|
@@ -363,11 +395,13 @@ Additionally, we would like to acknowledge the following notable contributions a
|
|
363
395
|
Xiaofeng Liu, Ph.D., P.E., Associate Professor, Department of Civil and Environmental Engineering
|
364
396
|
Institute of Computational and Data Sciences, Penn State University
|
365
397
|
|
398
|
+
3. Attribution: The[ffrd\rashdf'](https://github.com/fema-ffrd/rashdf) project by FEMA-FFRD (FEMA Future of Flood Risk Data) was incorporated, revised, adapted and extended in rascommander's RasHDF libaries (where noted).
|
399
|
+
|
366
400
|
These acknowledgments recognize the contributions and inspirations that have helped shape RAS Commander, ensuring proper attribution for the ideas and code that have influenced its development.
|
367
401
|
|
368
|
-
|
402
|
+
4. Chris Goodell, "Breaking the HEC-RAS Code" - Studied and used as a reference for understanding the inner workings of HEC-RAS, providing valuable insights into the software's functionality and structure.
|
369
403
|
|
370
|
-
|
404
|
+
5. [HEC-Commander Tools](https://github.com/billk-FM/HEC-Commander) - Inspiration and initial code base for the development of RAS Commander.
|
371
405
|
|
372
406
|
|
373
407
|
## Official RAS Commander AI-Generated Songs:
|
@@ -376,8 +410,17 @@ These acknowledgments recognize the contributions and inspirations that have hel
|
|
376
410
|
|
377
411
|
[No More Wait and See (Cajun Zydeco)](https://suno.com/song/4441c45d-f6cd-47b9-8fbc-1f7b277ee8ed)
|
378
412
|
|
413
|
+
## Other Resources
|
414
|
+
|
415
|
+
Notebook version of RAS-Commander: [RAS-Commander Notebook in the HEC-Commander Tools Repository](https://github.com/billk-FM/HEC-Commander/tree/main/RAS-Commander)
|
416
|
+
Youtube Tutorials for HEC-Commander Tools and RAS-Commander: [GPT-Commander on YouTube](https://www.youtube.com/@GPT_Commander/videos)
|
417
|
+
|
418
|
+
## LICENSE
|
419
|
+
|
420
|
+
This software is released under the MIT license.
|
421
|
+
|
379
422
|
|
380
423
|
## Contact
|
381
424
|
|
382
425
|
For questions, suggestions, or support, please contact:
|
383
|
-
William Katzenmeyer, P.E., C.F.M. -
|
426
|
+
William Katzenmeyer, P.E., C.F.M. - heccommander@gmail.com
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# RAS Commander (ras-commander)
|
2
2
|
|
3
|
-
RAS Commander is a Python library for automating HEC-RAS operations, providing a set of tools to interact with HEC-RAS project files, execute simulations, and manage project data. This library
|
3
|
+
RAS Commander is a Python library for automating HEC-RAS operations, providing a set of tools to interact with HEC-RAS project files, execute simulations, and manage project data. This library was initially conceptualized in the Australian Water School course "AI Tools for Modelling Innovation", and subsequently expanded to cover the basic functionality of the HECRASController COM32 interface using open-source python libraries. This library uses a Test Driven Development strategy, leveraging the publicly-available HEC-RAS Example projects to create repeatable demonstration examples. The "Commmander" moniker is inspired by the "Command Line is All You Need" approach to HEC-RAS automation that was first implemented in the HEC-Commander Tools repository.
|
4
4
|
|
5
5
|
## Contributors:
|
6
6
|
William Katzenmeyer, P.E., C.F.M.
|
@@ -11,9 +11,17 @@ Aaron Nichols, P.E., C.F.M.
|
|
11
11
|
|
12
12
|
(Additional Contributors Here)
|
13
13
|
|
14
|
-
## Don't Ask Me, Ask ChatGPT!
|
14
|
+
## Don't Ask Me, Ask ChatGPT!
|
15
15
|
|
16
|
-
|
16
|
+
This repository has several methods of interaction with Large Language Models and LLM-Assisted Coding built right in:
|
17
|
+
|
18
|
+
1. **[RAS Commander Library Assistant GPT](https://chatgpt.com/g/g-TZRPR3oAO-ras-commander-library-assistant)**: A specialized GPT model with access to the ras-commander codebase and library, available for answering queries and providing code suggestions. You can even upload your own plan, unsteady and HDF files to inspect and help determine how to automate your workflows or visualize your results, although this ability is still limited by OpenAI's GPT frameworks and may not be useful for long conversations.
|
19
|
+
|
20
|
+
2. **[Purpose-Built Knowledge Base Summaries](https://github.com/billk-FM/ras-commander/tree/main/ai_tools/assistant_knowledge_bases)**: Up-to-date compilations of the documentation and codebase for use with large language models like Claude or GPT-4. Look in 'ai_tools/assistant_knowledge_bases/' in the repo. The repo's codebase (without documentation and examples) has been curated to stay within the current ~200k context window limitations of frontier models, and for tasks that do not need an understanding of the underlying code, the Comprehensive Library Guide and any relevant examples from the example folder should be adequate context for leveraging the ras-commander API to complete tasks.
|
21
|
+
|
22
|
+
3. **[Cursor IDE Integration](https://github.com/billk-FM/ras-commander/blob/main/.cursorrules)**: Custom rules(.cursorrules) for the Cursor IDE to provide context-aware suggestions and documentation. Just open the repository folder in Cursor to recognize these instructions. You can create your own folders "/workspace/, "/projects/", or "my_projects/" as these are already in the .gitignore, and place your custom scripts there for your projects. This will allow easy referencing of the ras-commander documents and individual repo files, the automatic loading of the .cursorrules file. Alternatvely, download the github repo into your projects folder to easily load documents and use cursor rules files.
|
23
|
+
|
24
|
+
5. **[RAS-Commander Library Assistant](https://github.com/billk-FM/ras-commander/blob/main/library_assistant)**: A full-featured interface for multi-turn conversations, using your own API keys and the ras-commander library for context. The library assistant allows you to load your own scripts and chat with specific examples and/or function classes in the RAS-Commander library to effectively utilize the library's functions in your workflow. To reduce hallucinations, a file browser is included which adds full files to the conversation to ensure grounded responses. A dashboard shows you the total context and estimated cost of each request. **Now with support for OpenAI's o1 and o3-mini, and Deepseek V3 and R1 models using US-based Together.ai**
|
17
25
|
|
18
26
|
|
19
27
|
## Background
|
@@ -21,65 +29,90 @@ The ras-commander library emerged from the initial test-bed of AI-driven coding
|
|
21
29
|
|
22
30
|
## Features
|
23
31
|
|
24
|
-
|
25
|
-
- Support for both single and multiple project instances
|
26
|
-
- Parallel execution of HEC-RAS plans
|
27
|
-
- Utilities for managing geometry, plan, and unsteady flow files
|
28
|
-
- Example project management for testing and development
|
29
|
-
- Two primary operation modes: "Run Missing" and "Build from DSS"
|
30
|
-
|
31
|
-
## AI-Driven Coding Experience
|
32
|
+
If you've ever read the book "Breaking the HEC-RAS Code" by Chris Goodell, this library is intended to be an AI-coded, pythonic library that provides a modern alternative to the HECRASController API. By leveraginging modern python features libraries such as pandas, geopandas and H5Py (favoring HDF data sources wherever practicable) this library builds functionality around HEC-RAS 6.2+ while maintaining as much forward compatibilty as possible with HEC-RAS 2025.
|
32
33
|
|
33
|
-
|
34
|
+
HEC-RAS Project Management & Execution
|
35
|
+
- Multi-project handling with parallel and sequential execution
|
36
|
+
- Command-line execution integration
|
37
|
+
- Project folder management and organization
|
38
|
+
- Multi-core processing optimization
|
39
|
+
- Progress tracking and logging
|
40
|
+
- Execution error handling and recovery
|
34
41
|
|
35
|
-
1. **ChatGPT Assistant: [RAS Commander Library Assistant](https://chatgpt.com/g/g-TZRPR3oAO-ras-commander-library-assistant)**: A specialized GPT model trained on the ras-commander codebase, available for answering queries and providing code suggestions.
|
36
42
|
|
37
|
-
|
43
|
+
|
44
|
+
HDF Data Access & Analysis
|
45
|
+
- 2D mesh results processing (depths, velocities, WSE)
|
46
|
+
- Cross-section data extraction
|
47
|
+
- Boundary condition analysis
|
48
|
+
- Structure data (bridges, culverts, gates)
|
49
|
+
- Pipe network and pump station analysis
|
50
|
+
- Fluvial-pluvial boundary calculations
|
51
|
+
- Infiltration and precipitation data handling
|
38
52
|
|
39
|
-
|
40
|
-
|
53
|
+
|
54
|
+
RAS ASCII File Operations
|
55
|
+
- Plan file creation and modification
|
56
|
+
- Geometry file parsing examples
|
57
|
+
- Unsteady flow file management
|
58
|
+
- Project file updates and validation
|
41
59
|
|
60
|
+
Note about support for Pipe Networks: As a relatively new feature, only read access to Pipe Network geometry and results data has been included. Users will need to code their own methods to modify/add pipe network data, and pull requests are always welcome to incorporate this capability. Please note that the library has not been tested with versions prior to HEC-RAS 6.2.
|
42
61
|
|
43
62
|
## Installation
|
44
63
|
|
45
|
-
|
64
|
+
First, create a virtual environment with conda or venv (ask ChatGPT if you need help).
|
65
|
+
|
66
|
+
#### Install via Pip
|
46
67
|
|
47
68
|
In your virtual environment, install ras-commander using pip:
|
48
69
|
```
|
49
70
|
pip install h5py numpy pandas requests tqdm scipy xarray geopandas matplotlib ras-commander ipython tqdm psutil shapely fiona pathlib rtree rasterstats
|
50
71
|
pip install --upgrade ras-commander
|
51
72
|
```
|
52
|
-
|
53
|
-
**Tested with Python 3.11**
|
54
|
-
|
55
|
-
|
56
73
|
If you have dependency issues with pip (especially if you have errors with numpy), try clearing your local pip packages 'C:\Users\your_username\AppData\Roaming\Python\' and then creating a new virtual environment.
|
57
74
|
|
75
|
+
#### Work in a Local Copy
|
76
|
+
|
77
|
+
If you want to make revisions and work actively in your local version of ras-commander, just skip the pip install rascommander step above and clone a fork of the repo to your local machine using Git (ask ChatGPT if you need help). Most of the notebooks and examples in this repo have a code segment similar to the one below, that works as long as the script is located in a first-level subfolder of the ras-commander repository:
|
78
|
+
```
|
79
|
+
# Flexible imports to allow for development without installation
|
80
|
+
try:
|
81
|
+
# Try to import from the installed package
|
82
|
+
from ras_commander import init_ras_project, RasExamples, RasCmdr, RasPlan, RasGeo, RasUnsteady, RasUtils, ras
|
83
|
+
except ImportError:
|
84
|
+
# If the import fails, add the parent directory to the Python path
|
85
|
+
current_file = Path(__file__).resolve()
|
86
|
+
parent_directory = current_file.parent.parent
|
87
|
+
sys.path.append(str(parent_directory))
|
88
|
+
# Alternately, you can just define a path sys.path.append(r"c:/path/to/rascommander/rascommander)")
|
89
|
+
|
90
|
+
# Now try to import again
|
91
|
+
from ras_commander import init_ras_project, RasExamples, RasCmdr, RasPlan, RasGeo, RasUnsteady, RasUtils, ras
|
92
|
+
```
|
93
|
+
It is highly suggested to fork this repository before going this route, and using Git to manage your changes! This allows any revisions to the ras-commander classes and functions to be actively edited and developed by end users. The folders "/workspace/, "/projects/", or "my_projects/" are included in the .gitignore, so users can place you custom scripts there for any project data they don't want to be tracked by git.
|
94
|
+
|
58
95
|
|
59
|
-
## Requirements
|
60
96
|
|
61
|
-
|
62
|
-
- HEC-RAS 6.2 or later (other versions may work, all testing was done with version 6.2 and above)
|
63
|
-
- Detailed project workflows and/or existing libraries and code where ras-commander can be integrated.
|
97
|
+
|
64
98
|
|
65
|
-
|
99
|
+
## Quick Start Guide
|
66
100
|
|
67
|
-
## Quick Start
|
68
101
|
```
|
69
102
|
from ras_commander import init_ras_project, RasCmdr, RasPlan
|
70
103
|
```
|
71
104
|
|
72
|
-
|
105
|
+
### Initialize a project
|
73
106
|
```
|
74
107
|
init_ras_project(r"/path/to/project", "6.5")
|
75
108
|
```
|
76
109
|
|
77
|
-
|
110
|
+
### Execute a single plan
|
78
111
|
```
|
79
112
|
RasCmdr.compute_plan("01", dest_folder=r"/path/to/results", overwrite_dest=True)
|
80
113
|
```
|
81
114
|
|
82
|
-
|
115
|
+
### Execute plans in parallel
|
83
116
|
```
|
84
117
|
results = RasCmdr.compute_parallel(
|
85
118
|
plan_numbers=["01", "02"],
|
@@ -90,14 +123,14 @@ results = RasCmdr.compute_parallel(
|
|
90
123
|
)
|
91
124
|
```
|
92
125
|
|
93
|
-
|
126
|
+
### Modify a plan
|
94
127
|
```
|
95
128
|
RasPlan.set_geom("01", "02")
|
96
129
|
```
|
97
130
|
|
98
131
|
Certainly! I'll provide you with an updated Key Components section and Project Organization diagram based on the current structure of the ras-commander library.
|
99
132
|
|
100
|
-
|
133
|
+
#### Key Components
|
101
134
|
|
102
135
|
- `RasPrj`: Manages HEC-RAS projects, handling initialization and data loading
|
103
136
|
- `RasCmdr`: Handles execution of HEC-RAS simulations
|
@@ -107,7 +140,7 @@ Certainly! I'll provide you with an updated Key Components section and Project O
|
|
107
140
|
- `RasUtils`: Contains utility functions for file operations and data management
|
108
141
|
- `RasExamples`: Manages and loads HEC-RAS example projects
|
109
142
|
|
110
|
-
|
143
|
+
#### New Components:
|
111
144
|
- `HdfBase`: Core functionality for HDF file operations
|
112
145
|
- `HdfBndry`: Enhanced boundary condition handling
|
113
146
|
- `HdfMesh`: Comprehensive mesh data management
|
@@ -123,9 +156,9 @@ Certainly! I'll provide you with an updated Key Components section and Project O
|
|
123
156
|
- `RasToGo`: Go-Consequences integration
|
124
157
|
- `HdfPlot` & `HdfResultsPlot`: Specialized plotting utilities
|
125
158
|
|
126
|
-
|
159
|
+
### Project Organization Diagram
|
127
160
|
|
128
|
-
|
161
|
+
### Project Organization Diagram
|
129
162
|
|
130
163
|
```
|
131
164
|
ras_commander
|
@@ -188,7 +221,7 @@ ras_commander
|
|
188
221
|
└── requirements.txt
|
189
222
|
```
|
190
223
|
|
191
|
-
|
224
|
+
### Accessing HEC Examples through RasExamples
|
192
225
|
|
193
226
|
The `RasExamples` class provides functionality for quickly loading and managing HEC-RAS example projects. This is particularly useful for testing and development purposes.
|
194
227
|
|
@@ -209,7 +242,7 @@ projects = ras_examples.list_projects("Steady Flow")
|
|
209
242
|
extracted_paths = ras_examples.extract_project(["Bald Eagle Creek", "Muncie"])
|
210
243
|
```
|
211
244
|
|
212
|
-
|
245
|
+
### RasPrj
|
213
246
|
|
214
247
|
The `RasPrj` class is central to managing HEC-RAS projects within the ras-commander library. It handles project initialization, data loading, and provides access to project components.
|
215
248
|
|
@@ -225,18 +258,18 @@ Example usage:
|
|
225
258
|
from ras_commander import RasPrj, init_ras_project
|
226
259
|
```
|
227
260
|
|
228
|
-
|
261
|
+
#### Using the global ras object
|
229
262
|
```
|
230
263
|
init_ras_project("/path/to/project", "6.5")
|
231
264
|
```
|
232
265
|
|
233
|
-
|
266
|
+
#### Creating a custom RasPrj instance
|
234
267
|
```
|
235
268
|
custom_project = RasPrj()
|
236
269
|
init_ras_project("/path/to/another_project", "6.5", ras_instance=custom_project)
|
237
270
|
```
|
238
271
|
|
239
|
-
|
272
|
+
### RasHdf
|
240
273
|
|
241
274
|
The `RasHdf` class provides utilities for working with HDF files in HEC-RAS projects, enabling easy access to simulation results and model data.
|
242
275
|
|
@@ -257,7 +290,7 @@ print(runtime_data)
|
|
257
290
|
This class simplifies the process of extracting and analyzing data from HEC-RAS HDF output files, supporting tasks such as post-processing and result visualization.
|
258
291
|
|
259
292
|
|
260
|
-
|
293
|
+
#### Infrastructure Analysis
|
261
294
|
```python
|
262
295
|
from ras_commander import HdfPipe, HdfPump
|
263
296
|
|
@@ -270,7 +303,7 @@ pump_stations = HdfPump.get_pump_stations(hdf_path)
|
|
270
303
|
pump_performance = HdfPump.get_pump_station_summary(hdf_path)
|
271
304
|
```
|
272
305
|
|
273
|
-
|
306
|
+
#### Advanced Results Analysis
|
274
307
|
```python
|
275
308
|
from ras_commander import HdfResultsMesh
|
276
309
|
|
@@ -283,7 +316,7 @@ from ras_commander import HdfResultsPlot
|
|
283
316
|
HdfResultsPlot.plot_results_max_wsel(max_ws)
|
284
317
|
```
|
285
318
|
|
286
|
-
|
319
|
+
#### Fluvial-Pluvial Analysis
|
287
320
|
```python
|
288
321
|
from ras_commander import HdfFluvialPluvial
|
289
322
|
|
@@ -291,7 +324,7 @@ boundary = HdfFluvialPluvial.calculate_fluvial_pluvial_boundary(
|
|
291
324
|
hdf_path,
|
292
325
|
delta_t=12 # Time threshold in hours
|
293
326
|
)
|
294
|
-
|
327
|
+
```
|
295
328
|
|
296
329
|
## Documentation
|
297
330
|
|
@@ -306,7 +339,6 @@ Check out the `examples/` directory for sample scripts demonstrating various fea
|
|
306
339
|
The ras-commander library is an ongoing project. Future plans include:
|
307
340
|
- Integration of more advanced AI-driven features
|
308
341
|
- Expansion of HMS and DSS functionalities
|
309
|
-
- Enhanced GPU support for computational tasks
|
310
342
|
- Community-driven development of new modules and features
|
311
343
|
|
312
344
|
## Related Resources
|
@@ -345,11 +377,13 @@ Additionally, we would like to acknowledge the following notable contributions a
|
|
345
377
|
Xiaofeng Liu, Ph.D., P.E., Associate Professor, Department of Civil and Environmental Engineering
|
346
378
|
Institute of Computational and Data Sciences, Penn State University
|
347
379
|
|
380
|
+
3. Attribution: The[ffrd\rashdf'](https://github.com/fema-ffrd/rashdf) project by FEMA-FFRD (FEMA Future of Flood Risk Data) was incorporated, revised, adapted and extended in rascommander's RasHDF libaries (where noted).
|
381
|
+
|
348
382
|
These acknowledgments recognize the contributions and inspirations that have helped shape RAS Commander, ensuring proper attribution for the ideas and code that have influenced its development.
|
349
383
|
|
350
|
-
|
384
|
+
4. Chris Goodell, "Breaking the HEC-RAS Code" - Studied and used as a reference for understanding the inner workings of HEC-RAS, providing valuable insights into the software's functionality and structure.
|
351
385
|
|
352
|
-
|
386
|
+
5. [HEC-Commander Tools](https://github.com/billk-FM/HEC-Commander) - Inspiration and initial code base for the development of RAS Commander.
|
353
387
|
|
354
388
|
|
355
389
|
## Official RAS Commander AI-Generated Songs:
|
@@ -358,8 +392,17 @@ These acknowledgments recognize the contributions and inspirations that have hel
|
|
358
392
|
|
359
393
|
[No More Wait and See (Cajun Zydeco)](https://suno.com/song/4441c45d-f6cd-47b9-8fbc-1f7b277ee8ed)
|
360
394
|
|
395
|
+
## Other Resources
|
396
|
+
|
397
|
+
Notebook version of RAS-Commander: [RAS-Commander Notebook in the HEC-Commander Tools Repository](https://github.com/billk-FM/HEC-Commander/tree/main/RAS-Commander)
|
398
|
+
Youtube Tutorials for HEC-Commander Tools and RAS-Commander: [GPT-Commander on YouTube](https://www.youtube.com/@GPT_Commander/videos)
|
399
|
+
|
400
|
+
## LICENSE
|
401
|
+
|
402
|
+
This software is released under the MIT license.
|
403
|
+
|
361
404
|
|
362
405
|
## Contact
|
363
406
|
|
364
407
|
For questions, suggestions, or support, please contact:
|
365
|
-
William Katzenmeyer, P.E., C.F.M. -
|
408
|
+
William Katzenmeyer, P.E., C.F.M. - heccommander@gmail.com
|