ras-commander 0.51.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.
Files changed (41) hide show
  1. {ras_commander-0.51.0/ras_commander.egg-info → ras_commander-0.53.0}/PKG-INFO +99 -53
  2. {ras_commander-0.51.0 → ras_commander-0.53.0}/README.md +90 -51
  3. {ras_commander-0.51.0 → ras_commander-0.53.0}/ras_commander/Decorators.py +137 -127
  4. {ras_commander-0.51.0 → ras_commander-0.53.0}/ras_commander/HdfBase.py +359 -307
  5. ras_commander-0.53.0/ras_commander/HdfFluvialPluvial.py +554 -0
  6. {ras_commander-0.51.0 → ras_commander-0.53.0}/ras_commander/HdfMesh.py +461 -461
  7. ras_commander-0.53.0/ras_commander/HdfResultsPlan.py +365 -0
  8. {ras_commander-0.51.0 → ras_commander-0.53.0}/ras_commander/HdfStruc.py +1 -1
  9. {ras_commander-0.51.0 → ras_commander-0.53.0}/ras_commander/HdfUtils.py +434 -434
  10. {ras_commander-0.51.0 → ras_commander-0.53.0}/ras_commander/HdfXsec.py +58 -40
  11. {ras_commander-0.51.0 → ras_commander-0.53.0}/ras_commander/LoggingConfig.py +2 -1
  12. {ras_commander-0.51.0 → ras_commander-0.53.0}/ras_commander/RasCmdr.py +45 -20
  13. {ras_commander-0.51.0 → ras_commander-0.53.0}/ras_commander/RasPlan.py +74 -65
  14. {ras_commander-0.51.0 → ras_commander-0.53.0}/ras_commander/RasPrj.py +934 -879
  15. {ras_commander-0.51.0 → ras_commander-0.53.0}/ras_commander/RasUnsteady.py +38 -19
  16. {ras_commander-0.51.0 → ras_commander-0.53.0/ras_commander.egg-info}/PKG-INFO +99 -53
  17. {ras_commander-0.51.0 → ras_commander-0.53.0}/setup.py +1 -1
  18. ras_commander-0.51.0/ras_commander/HdfFluvialPluvial.py +0 -309
  19. ras_commander-0.51.0/ras_commander/HdfResultsPlan.py +0 -257
  20. {ras_commander-0.51.0 → ras_commander-0.53.0}/LICENSE +0 -0
  21. {ras_commander-0.51.0 → ras_commander-0.53.0}/pyproject.toml +0 -0
  22. {ras_commander-0.51.0 → ras_commander-0.53.0}/ras_commander/HdfBndry.py +0 -0
  23. {ras_commander-0.51.0 → ras_commander-0.53.0}/ras_commander/HdfInfiltration.py +0 -0
  24. {ras_commander-0.51.0 → ras_commander-0.53.0}/ras_commander/HdfPipe.py +0 -0
  25. {ras_commander-0.51.0 → ras_commander-0.53.0}/ras_commander/HdfPlan.py +0 -0
  26. {ras_commander-0.51.0 → ras_commander-0.53.0}/ras_commander/HdfPlot.py +0 -0
  27. {ras_commander-0.51.0 → ras_commander-0.53.0}/ras_commander/HdfPump.py +0 -0
  28. {ras_commander-0.51.0 → ras_commander-0.53.0}/ras_commander/HdfResultsMesh.py +0 -0
  29. {ras_commander-0.51.0 → ras_commander-0.53.0}/ras_commander/HdfResultsPlot.py +0 -0
  30. {ras_commander-0.51.0 → ras_commander-0.53.0}/ras_commander/HdfResultsXsec.py +0 -0
  31. {ras_commander-0.51.0 → ras_commander-0.53.0}/ras_commander/RasExamples.py +0 -0
  32. {ras_commander-0.51.0 → ras_commander-0.53.0}/ras_commander/RasGeo.py +0 -0
  33. {ras_commander-0.51.0 → ras_commander-0.53.0}/ras_commander/RasGpt.py +0 -0
  34. {ras_commander-0.51.0 → ras_commander-0.53.0}/ras_commander/RasMapper.py +0 -0
  35. {ras_commander-0.51.0 → ras_commander-0.53.0}/ras_commander/RasToGo.py +0 -0
  36. {ras_commander-0.51.0 → ras_commander-0.53.0}/ras_commander/RasUtils.py +0 -0
  37. {ras_commander-0.51.0 → ras_commander-0.53.0}/ras_commander/__init__.py +0 -0
  38. {ras_commander-0.51.0 → ras_commander-0.53.0}/ras_commander.egg-info/SOURCES.txt +0 -0
  39. {ras_commander-0.51.0 → ras_commander-0.53.0}/ras_commander.egg-info/dependency_links.txt +0 -0
  40. {ras_commander-0.51.0 → ras_commander-0.53.0}/ras_commander.egg-info/top_level.txt +0 -0
  41. {ras_commander-0.51.0 → ras_commander-0.53.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: ras-commander
3
- Version: 0.51.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
@@ -8,10 +8,17 @@ Author-email: billk@fenstermaker.com
8
8
  Requires-Python: >=3.10
9
9
  Description-Content-Type: text/markdown
10
10
  License-File: LICENSE
11
+ Dynamic: author
12
+ Dynamic: author-email
13
+ Dynamic: description
14
+ Dynamic: description-content-type
15
+ Dynamic: home-page
16
+ Dynamic: requires-python
17
+ Dynamic: summary
11
18
 
12
19
  # RAS Commander (ras-commander)
13
20
 
14
- 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 is an evolution of the RASCommander 1.0 Python Notebook Application previously released under the [HEC-Commander tools repository](https://github.com/billk-FM/HEC-Commander).
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.
15
22
 
16
23
  ## Contributors:
17
24
  William Katzenmeyer, P.E., C.F.M.
@@ -22,79 +29,108 @@ Aaron Nichols, P.E., C.F.M.
22
29
 
23
30
  (Additional Contributors Here)
24
31
 
25
- ## Don't Ask Me, Ask ChatGPT!
32
+ ## Don't Ask Me, Ask ChatGPT!
26
33
 
27
- Before you read any further, you can [chat directly with ChatGPT on this topic.](https://chatgpt.com/g/g-TZRPR3oAO-ras-commander-library-assistant) Ask it anything, and it will use its tools to answer your questions and help you learn. 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.
34
+ This repository has several methods of interaction with Large Language Models and LLM-Assisted Coding built right in:
28
35
 
29
- There are also [AI Assistant Knowledge Bases](https://github.com/billk-FM/ras-commander/tree/main/ai_tools/assistant_knowledge_bases) with various versions available to directly use with large context LLM models such as Anthropic's Claude, Google Gemini and OpenAI's GPT4o and o1 models.
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**
30
43
 
31
- FUTURE: TEMPLATES are available to use with AI Assistant Notebooks to build your own automation tools. When used with large context models, these templates allow you to ask GPT to build a workflow from scratch to automate your projects.
32
44
 
33
45
  ## Background
34
46
  The ras-commander library emerged from the initial test-bed of AI-driven coding represented by the HEC-Commander tools Python notebooks. These notebooks served as a proof of concept, demonstrating the value proposition of automating HEC-RAS operations. The transition from notebooks to a structured library aims to provide a more robust, maintainable, and extensible solution for water resources engineers.
35
47
 
36
48
  ## Features
37
49
 
38
- - Automate HEC-RAS project management and simulations
39
- - Support for both single and multiple project instances
40
- - Parallel execution of HEC-RAS plans
41
- - Utilities for managing geometry, plan, and unsteady flow files
42
- - Example project management for testing and development
43
- - Two primary operation modes: "Run Missing" and "Build from DSS"
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.
44
51
 
45
- ## AI-Driven Coding Experience
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
46
59
 
47
- ras-commander provides several AI-powered tools to enhance the coding experience:
48
60
 
49
- 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.
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
50
70
 
51
- 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.
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
52
77
 
53
- 3. **[Cursor IDE Integration](https://github.com/billk-FM/ras-commander/blob/main/.cursorrules)**: Custom rules for the Cursor IDE to provide context-aware suggestions and documentation. Just open the repository folder in Cursor. 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.
54
- 4. **[AI Assistant Notebook](https://github.com/billk-FM/ras-commander/blob/main/ai_tools/rascommander_code_assistant.ipynb)**: A notebook for dynamic code summarization and API interaction (bring your own API Key). Currently, this only does a single-shot message on the Claude Sonnet 3.5 API, which can be up to 50 cents per request. Future revisions will include the ability to select which knowledge base file to include, a choice of SOTA models + multi turn conversations to build automation notebooks interactively.
55
-
56
- These tools aim to streamline development and provide intelligent assistance when modeling with, and working with and revising the ras-commander library.
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.
57
79
 
58
80
  ## Installation
59
81
 
60
- Create a virtual environment with conda or venv (ask ChatGPT if you need help)
82
+ First, create a virtual environment with conda or venv (ask ChatGPT if you need help).
83
+
84
+ #### Install via Pip
61
85
 
62
86
  In your virtual environment, install ras-commander using pip:
63
87
  ```
64
88
  pip install h5py numpy pandas requests tqdm scipy xarray geopandas matplotlib ras-commander ipython tqdm psutil shapely fiona pathlib rtree rasterstats
65
89
  pip install --upgrade ras-commander
66
90
  ```
67
-
68
- **Tested with Python 3.11**
69
-
70
-
71
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.
72
92
 
93
+ #### Work in a Local Copy
73
94
 
74
- ## Requirements
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.
75
112
 
76
- - Tested with Python 3.11
77
- - HEC-RAS 6.2 or later (other versions may work, all testing was done with version 6.2 and above)
78
- - Detailed project workflows and/or existing libraries and code where ras-commander can be integrated.
79
113
 
80
- For a full list of dependencies, see the `requirements.txt` file.
81
114
 
82
- ## Quick Start
115
+
116
+
117
+ ## Quick Start Guide
118
+
83
119
  ```
84
120
  from ras_commander import init_ras_project, RasCmdr, RasPlan
85
121
  ```
86
122
 
87
- # Initialize a project
123
+ ### Initialize a project
88
124
  ```
89
125
  init_ras_project(r"/path/to/project", "6.5")
90
126
  ```
91
127
 
92
- # Execute a single plan
128
+ ### Execute a single plan
93
129
  ```
94
130
  RasCmdr.compute_plan("01", dest_folder=r"/path/to/results", overwrite_dest=True)
95
131
  ```
96
132
 
97
- # Execute plans in parallel
133
+ ### Execute plans in parallel
98
134
  ```
99
135
  results = RasCmdr.compute_parallel(
100
136
  plan_numbers=["01", "02"],
@@ -105,14 +141,14 @@ results = RasCmdr.compute_parallel(
105
141
  )
106
142
  ```
107
143
 
108
- # Modify a plan
144
+ ### Modify a plan
109
145
  ```
110
146
  RasPlan.set_geom("01", "02")
111
147
  ```
112
148
 
113
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.
114
150
 
115
- ## Key Components
151
+ #### Key Components
116
152
 
117
153
  - `RasPrj`: Manages HEC-RAS projects, handling initialization and data loading
118
154
  - `RasCmdr`: Handles execution of HEC-RAS simulations
@@ -122,7 +158,7 @@ Certainly! I'll provide you with an updated Key Components section and Project O
122
158
  - `RasUtils`: Contains utility functions for file operations and data management
123
159
  - `RasExamples`: Manages and loads HEC-RAS example projects
124
160
 
125
- ### New Components:
161
+ #### New Components:
126
162
  - `HdfBase`: Core functionality for HDF file operations
127
163
  - `HdfBndry`: Enhanced boundary condition handling
128
164
  - `HdfMesh`: Comprehensive mesh data management
@@ -138,9 +174,9 @@ Certainly! I'll provide you with an updated Key Components section and Project O
138
174
  - `RasToGo`: Go-Consequences integration
139
175
  - `HdfPlot` & `HdfResultsPlot`: Specialized plotting utilities
140
176
 
141
- ## Project Organization Diagram
177
+ ### Project Organization Diagram
142
178
 
143
- ## Project Organization Diagram
179
+ ### Project Organization Diagram
144
180
 
145
181
  ```
146
182
  ras_commander
@@ -203,7 +239,7 @@ ras_commander
203
239
  └── requirements.txt
204
240
  ```
205
241
 
206
- ## Accessing HEC Examples through RasExamples
242
+ ### Accessing HEC Examples through RasExamples
207
243
 
208
244
  The `RasExamples` class provides functionality for quickly loading and managing HEC-RAS example projects. This is particularly useful for testing and development purposes.
209
245
 
@@ -224,7 +260,7 @@ projects = ras_examples.list_projects("Steady Flow")
224
260
  extracted_paths = ras_examples.extract_project(["Bald Eagle Creek", "Muncie"])
225
261
  ```
226
262
 
227
- ## RasPrj
263
+ ### RasPrj
228
264
 
229
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.
230
266
 
@@ -240,18 +276,18 @@ Example usage:
240
276
  from ras_commander import RasPrj, init_ras_project
241
277
  ```
242
278
 
243
- ### Using the global ras object
279
+ #### Using the global ras object
244
280
  ```
245
281
  init_ras_project("/path/to/project", "6.5")
246
282
  ```
247
283
 
248
- ### Creating a custom RasPrj instance
284
+ #### Creating a custom RasPrj instance
249
285
  ```
250
286
  custom_project = RasPrj()
251
287
  init_ras_project("/path/to/another_project", "6.5", ras_instance=custom_project)
252
288
  ```
253
289
 
254
- ## RasHdf
290
+ ### RasHdf
255
291
 
256
292
  The `RasHdf` class provides utilities for working with HDF files in HEC-RAS projects, enabling easy access to simulation results and model data.
257
293
 
@@ -272,7 +308,7 @@ print(runtime_data)
272
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.
273
309
 
274
310
 
275
- ### Infrastructure Analysis
311
+ #### Infrastructure Analysis
276
312
  ```python
277
313
  from ras_commander import HdfPipe, HdfPump
278
314
 
@@ -285,7 +321,7 @@ pump_stations = HdfPump.get_pump_stations(hdf_path)
285
321
  pump_performance = HdfPump.get_pump_station_summary(hdf_path)
286
322
  ```
287
323
 
288
- ### Advanced Results Analysis
324
+ #### Advanced Results Analysis
289
325
  ```python
290
326
  from ras_commander import HdfResultsMesh
291
327
 
@@ -298,7 +334,7 @@ from ras_commander import HdfResultsPlot
298
334
  HdfResultsPlot.plot_results_max_wsel(max_ws)
299
335
  ```
300
336
 
301
- ### Fluvial-Pluvial Analysis
337
+ #### Fluvial-Pluvial Analysis
302
338
  ```python
303
339
  from ras_commander import HdfFluvialPluvial
304
340
 
@@ -306,7 +342,7 @@ boundary = HdfFluvialPluvial.calculate_fluvial_pluvial_boundary(
306
342
  hdf_path,
307
343
  delta_t=12 # Time threshold in hours
308
344
  )
309
-
345
+ ```
310
346
 
311
347
  ## Documentation
312
348
 
@@ -321,7 +357,6 @@ Check out the `examples/` directory for sample scripts demonstrating various fea
321
357
  The ras-commander library is an ongoing project. Future plans include:
322
358
  - Integration of more advanced AI-driven features
323
359
  - Expansion of HMS and DSS functionalities
324
- - Enhanced GPU support for computational tasks
325
360
  - Community-driven development of new modules and features
326
361
 
327
362
  ## Related Resources
@@ -360,11 +395,13 @@ Additionally, we would like to acknowledge the following notable contributions a
360
395
  Xiaofeng Liu, Ph.D., P.E., Associate Professor, Department of Civil and Environmental Engineering
361
396
  Institute of Computational and Data Sciences, Penn State University
362
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
+
363
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.
364
401
 
365
- 3. 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.
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.
366
403
 
367
- 4. [HEC-Commander Tools](https://github.com/billk-FM/HEC-Commander) - Inspiration and initial code base for the development of RAS Commander.
404
+ 5. [HEC-Commander Tools](https://github.com/billk-FM/HEC-Commander) - Inspiration and initial code base for the development of RAS Commander.
368
405
 
369
406
 
370
407
  ## Official RAS Commander AI-Generated Songs:
@@ -373,8 +410,17 @@ These acknowledgments recognize the contributions and inspirations that have hel
373
410
 
374
411
  [No More Wait and See (Cajun Zydeco)](https://suno.com/song/4441c45d-f6cd-47b9-8fbc-1f7b277ee8ed)
375
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
+
376
422
 
377
423
  ## Contact
378
424
 
379
425
  For questions, suggestions, or support, please contact:
380
- William Katzenmeyer, P.E., C.F.M. - billk@fenstermaker.com
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 is an evolution of the RASCommander 1.0 Python Notebook Application previously released under the [HEC-Commander tools repository](https://github.com/billk-FM/HEC-Commander).
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,79 +11,108 @@ 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
- Before you read any further, you can [chat directly with ChatGPT on this topic.](https://chatgpt.com/g/g-TZRPR3oAO-ras-commander-library-assistant) Ask it anything, and it will use its tools to answer your questions and help you learn. 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.
16
+ This repository has several methods of interaction with Large Language Models and LLM-Assisted Coding built right in:
17
17
 
18
- There are also [AI Assistant Knowledge Bases](https://github.com/billk-FM/ras-commander/tree/main/ai_tools/assistant_knowledge_bases) with various versions available to directly use with large context LLM models such as Anthropic's Claude, Google Gemini and OpenAI's GPT4o and o1 models.
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**
19
25
 
20
- FUTURE: TEMPLATES are available to use with AI Assistant Notebooks to build your own automation tools. When used with large context models, these templates allow you to ask GPT to build a workflow from scratch to automate your projects.
21
26
 
22
27
  ## Background
23
28
  The ras-commander library emerged from the initial test-bed of AI-driven coding represented by the HEC-Commander tools Python notebooks. These notebooks served as a proof of concept, demonstrating the value proposition of automating HEC-RAS operations. The transition from notebooks to a structured library aims to provide a more robust, maintainable, and extensible solution for water resources engineers.
24
29
 
25
30
  ## Features
26
31
 
27
- - Automate HEC-RAS project management and simulations
28
- - Support for both single and multiple project instances
29
- - Parallel execution of HEC-RAS plans
30
- - Utilities for managing geometry, plan, and unsteady flow files
31
- - Example project management for testing and development
32
- - Two primary operation modes: "Run Missing" and "Build from DSS"
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.
33
33
 
34
- ## AI-Driven Coding Experience
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
35
41
 
36
- ras-commander provides several AI-powered tools to enhance the coding experience:
37
42
 
38
- 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.
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
39
52
 
40
- 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.
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
 
42
- 3. **[Cursor IDE Integration](https://github.com/billk-FM/ras-commander/blob/main/.cursorrules)**: Custom rules for the Cursor IDE to provide context-aware suggestions and documentation. Just open the repository folder in Cursor. 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.
43
- 4. **[AI Assistant Notebook](https://github.com/billk-FM/ras-commander/blob/main/ai_tools/rascommander_code_assistant.ipynb)**: A notebook for dynamic code summarization and API interaction (bring your own API Key). Currently, this only does a single-shot message on the Claude Sonnet 3.5 API, which can be up to 50 cents per request. Future revisions will include the ability to select which knowledge base file to include, a choice of SOTA models + multi turn conversations to build automation notebooks interactively.
44
-
45
- These tools aim to streamline development and provide intelligent assistance when modeling with, and working with and revising the ras-commander library.
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.
46
61
 
47
62
  ## Installation
48
63
 
49
- Create a virtual environment with conda or venv (ask ChatGPT if you need help)
64
+ First, create a virtual environment with conda or venv (ask ChatGPT if you need help).
65
+
66
+ #### Install via Pip
50
67
 
51
68
  In your virtual environment, install ras-commander using pip:
52
69
  ```
53
70
  pip install h5py numpy pandas requests tqdm scipy xarray geopandas matplotlib ras-commander ipython tqdm psutil shapely fiona pathlib rtree rasterstats
54
71
  pip install --upgrade ras-commander
55
72
  ```
56
-
57
- **Tested with Python 3.11**
58
-
59
-
60
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.
61
74
 
75
+ #### Work in a Local Copy
62
76
 
63
- ## Requirements
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.
64
94
 
65
- - Tested with Python 3.11
66
- - HEC-RAS 6.2 or later (other versions may work, all testing was done with version 6.2 and above)
67
- - Detailed project workflows and/or existing libraries and code where ras-commander can be integrated.
68
95
 
69
- For a full list of dependencies, see the `requirements.txt` file.
70
96
 
71
- ## Quick Start
97
+
98
+
99
+ ## Quick Start Guide
100
+
72
101
  ```
73
102
  from ras_commander import init_ras_project, RasCmdr, RasPlan
74
103
  ```
75
104
 
76
- # Initialize a project
105
+ ### Initialize a project
77
106
  ```
78
107
  init_ras_project(r"/path/to/project", "6.5")
79
108
  ```
80
109
 
81
- # Execute a single plan
110
+ ### Execute a single plan
82
111
  ```
83
112
  RasCmdr.compute_plan("01", dest_folder=r"/path/to/results", overwrite_dest=True)
84
113
  ```
85
114
 
86
- # Execute plans in parallel
115
+ ### Execute plans in parallel
87
116
  ```
88
117
  results = RasCmdr.compute_parallel(
89
118
  plan_numbers=["01", "02"],
@@ -94,14 +123,14 @@ results = RasCmdr.compute_parallel(
94
123
  )
95
124
  ```
96
125
 
97
- # Modify a plan
126
+ ### Modify a plan
98
127
  ```
99
128
  RasPlan.set_geom("01", "02")
100
129
  ```
101
130
 
102
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.
103
132
 
104
- ## Key Components
133
+ #### Key Components
105
134
 
106
135
  - `RasPrj`: Manages HEC-RAS projects, handling initialization and data loading
107
136
  - `RasCmdr`: Handles execution of HEC-RAS simulations
@@ -111,7 +140,7 @@ Certainly! I'll provide you with an updated Key Components section and Project O
111
140
  - `RasUtils`: Contains utility functions for file operations and data management
112
141
  - `RasExamples`: Manages and loads HEC-RAS example projects
113
142
 
114
- ### New Components:
143
+ #### New Components:
115
144
  - `HdfBase`: Core functionality for HDF file operations
116
145
  - `HdfBndry`: Enhanced boundary condition handling
117
146
  - `HdfMesh`: Comprehensive mesh data management
@@ -127,9 +156,9 @@ Certainly! I'll provide you with an updated Key Components section and Project O
127
156
  - `RasToGo`: Go-Consequences integration
128
157
  - `HdfPlot` & `HdfResultsPlot`: Specialized plotting utilities
129
158
 
130
- ## Project Organization Diagram
159
+ ### Project Organization Diagram
131
160
 
132
- ## Project Organization Diagram
161
+ ### Project Organization Diagram
133
162
 
134
163
  ```
135
164
  ras_commander
@@ -192,7 +221,7 @@ ras_commander
192
221
  └── requirements.txt
193
222
  ```
194
223
 
195
- ## Accessing HEC Examples through RasExamples
224
+ ### Accessing HEC Examples through RasExamples
196
225
 
197
226
  The `RasExamples` class provides functionality for quickly loading and managing HEC-RAS example projects. This is particularly useful for testing and development purposes.
198
227
 
@@ -213,7 +242,7 @@ projects = ras_examples.list_projects("Steady Flow")
213
242
  extracted_paths = ras_examples.extract_project(["Bald Eagle Creek", "Muncie"])
214
243
  ```
215
244
 
216
- ## RasPrj
245
+ ### RasPrj
217
246
 
218
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.
219
248
 
@@ -229,18 +258,18 @@ Example usage:
229
258
  from ras_commander import RasPrj, init_ras_project
230
259
  ```
231
260
 
232
- ### Using the global ras object
261
+ #### Using the global ras object
233
262
  ```
234
263
  init_ras_project("/path/to/project", "6.5")
235
264
  ```
236
265
 
237
- ### Creating a custom RasPrj instance
266
+ #### Creating a custom RasPrj instance
238
267
  ```
239
268
  custom_project = RasPrj()
240
269
  init_ras_project("/path/to/another_project", "6.5", ras_instance=custom_project)
241
270
  ```
242
271
 
243
- ## RasHdf
272
+ ### RasHdf
244
273
 
245
274
  The `RasHdf` class provides utilities for working with HDF files in HEC-RAS projects, enabling easy access to simulation results and model data.
246
275
 
@@ -261,7 +290,7 @@ print(runtime_data)
261
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.
262
291
 
263
292
 
264
- ### Infrastructure Analysis
293
+ #### Infrastructure Analysis
265
294
  ```python
266
295
  from ras_commander import HdfPipe, HdfPump
267
296
 
@@ -274,7 +303,7 @@ pump_stations = HdfPump.get_pump_stations(hdf_path)
274
303
  pump_performance = HdfPump.get_pump_station_summary(hdf_path)
275
304
  ```
276
305
 
277
- ### Advanced Results Analysis
306
+ #### Advanced Results Analysis
278
307
  ```python
279
308
  from ras_commander import HdfResultsMesh
280
309
 
@@ -287,7 +316,7 @@ from ras_commander import HdfResultsPlot
287
316
  HdfResultsPlot.plot_results_max_wsel(max_ws)
288
317
  ```
289
318
 
290
- ### Fluvial-Pluvial Analysis
319
+ #### Fluvial-Pluvial Analysis
291
320
  ```python
292
321
  from ras_commander import HdfFluvialPluvial
293
322
 
@@ -295,7 +324,7 @@ boundary = HdfFluvialPluvial.calculate_fluvial_pluvial_boundary(
295
324
  hdf_path,
296
325
  delta_t=12 # Time threshold in hours
297
326
  )
298
-
327
+ ```
299
328
 
300
329
  ## Documentation
301
330
 
@@ -310,7 +339,6 @@ Check out the `examples/` directory for sample scripts demonstrating various fea
310
339
  The ras-commander library is an ongoing project. Future plans include:
311
340
  - Integration of more advanced AI-driven features
312
341
  - Expansion of HMS and DSS functionalities
313
- - Enhanced GPU support for computational tasks
314
342
  - Community-driven development of new modules and features
315
343
 
316
344
  ## Related Resources
@@ -349,11 +377,13 @@ Additionally, we would like to acknowledge the following notable contributions a
349
377
  Xiaofeng Liu, Ph.D., P.E., Associate Professor, Department of Civil and Environmental Engineering
350
378
  Institute of Computational and Data Sciences, Penn State University
351
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
+
352
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.
353
383
 
354
- 3. 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.
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.
355
385
 
356
- 4. [HEC-Commander Tools](https://github.com/billk-FM/HEC-Commander) - Inspiration and initial code base for the development of RAS Commander.
386
+ 5. [HEC-Commander Tools](https://github.com/billk-FM/HEC-Commander) - Inspiration and initial code base for the development of RAS Commander.
357
387
 
358
388
 
359
389
  ## Official RAS Commander AI-Generated Songs:
@@ -362,8 +392,17 @@ These acknowledgments recognize the contributions and inspirations that have hel
362
392
 
363
393
  [No More Wait and See (Cajun Zydeco)](https://suno.com/song/4441c45d-f6cd-47b9-8fbc-1f7b277ee8ed)
364
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
+
365
404
 
366
405
  ## Contact
367
406
 
368
407
  For questions, suggestions, or support, please contact:
369
- William Katzenmeyer, P.E., C.F.M. - billk@fenstermaker.com
408
+ William Katzenmeyer, P.E., C.F.M. - heccommander@gmail.com