ras-commander 0.24.0.dev0__tar.gz → 0.34.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 (94) hide show
  1. ras_commander-0.34.0/PKG-INFO +263 -0
  2. ras_commander-0.34.0/README.md +235 -0
  3. ras_commander-0.34.0/pyproject.toml +3 -0
  4. {ras_commander-0.24.0.dev0 → ras_commander-0.34.0}/ras_commander/RasCmdr.py +481 -449
  5. {ras_commander-0.24.0.dev0 → ras_commander-0.34.0}/ras_commander/RasExamples.py +354 -304
  6. {ras_commander-0.24.0.dev0 → ras_commander-0.34.0}/ras_commander/RasGeo.py +109 -88
  7. ras_commander-0.34.0/ras_commander/RasHdf.py +248 -0
  8. {ras_commander-0.24.0.dev0 → ras_commander-0.34.0}/ras_commander/RasPlan.py +1220 -1266
  9. ras_commander-0.34.0/ras_commander/RasPrj.py +732 -0
  10. {ras_commander-0.24.0.dev0 → ras_commander-0.34.0}/ras_commander/RasUnsteady.py +93 -73
  11. ras_commander-0.34.0/ras_commander/RasUtils.py +611 -0
  12. {ras_commander-0.24.0.dev0 → ras_commander-0.34.0}/ras_commander/__init__.py +4 -1
  13. {ras_commander-0.24.0.dev0 → ras_commander-0.34.0}/ras_commander/_version.py +16 -16
  14. ras_commander-0.34.0/ras_commander.egg-info/PKG-INFO +263 -0
  15. ras_commander-0.34.0/ras_commander.egg-info/SOURCES.txt +19 -0
  16. ras_commander-0.34.0/ras_commander.egg-info/requires.txt +15 -0
  17. {ras_commander-0.24.0.dev0 → ras_commander-0.34.0}/setup.cfg +4 -7
  18. ras_commander-0.34.0/setup.py +74 -0
  19. ras_commander-0.24.0.dev0/.cursorrules +0 -100
  20. ras_commander-0.24.0.dev0/.github/workflows/publish-to-pypi.yml +0 -58
  21. ras_commander-0.24.0.dev0/.gitignore/.gitignore +0 -8
  22. ras_commander-0.24.0.dev0/Comprehensive_Library_Guide.md +0 -277
  23. ras_commander-0.24.0.dev0/PKG-INFO +0 -201
  24. ras_commander-0.24.0.dev0/README.md +0 -188
  25. ras_commander-0.24.0.dev0/STYLE_GUIDE.md +0 -191
  26. ras_commander-0.24.0.dev0/ai_tools/README.md +0 -3
  27. ras_commander-0.24.0.dev0/ai_tools/llm_summary/ras-commander.txt +0 -7386
  28. ras_commander-0.24.0.dev0/ai_tools/llmsummarize 1. full repo.py +0 -66
  29. ras_commander-0.24.0.dev0/ai_tools/llmsummarize 2. docs and code only.py +0 -66
  30. ras_commander-0.24.0.dev0/ai_tools/llmsummarize 3. documentation and docstrings.py +0 -80
  31. ras_commander-0.24.0.dev0/ai_tools/rascommander_code_assistant.ipynb +0 -760
  32. ras_commander-0.24.0.dev0/examples/01_project_initialization.py +0 -138
  33. ras_commander-0.24.0.dev0/examples/02_plan_operations.py +0 -152
  34. ras_commander-0.24.0.dev0/examples/03_geometry_operations.py +0 -112
  35. ras_commander-0.24.0.dev0/examples/04_unsteady_flow_operations.py +0 -106
  36. ras_commander-0.24.0.dev0/examples/05_utility_functions.py +0 -74
  37. ras_commander-0.24.0.dev0/examples/06_single_plan_execution.py +0 -134
  38. ras_commander-0.24.0.dev0/examples/07_sequential_plan_execution.py +0 -105
  39. ras_commander-0.24.0.dev0/examples/08_parallel_execution.py +0 -95
  40. ras_commander-0.24.0.dev0/examples/09_specifying_plans.py +0 -100
  41. ras_commander-0.24.0.dev0/examples/10_arguments_for_compute.py +0 -117
  42. ras_commander-0.24.0.dev0/examples/11_Using_RasExamples.ipynb +0 -456
  43. ras_commander-0.24.0.dev0/examples/12_plan_set_execution.py +0 -95
  44. ras_commander-0.24.0.dev0/examples/13_multiple_project_operations.py +0 -135
  45. ras_commander-0.24.0.dev0/examples/14_Core_Sensitivity.ipynb +0 -123
  46. ras_commander-0.24.0.dev0/examples/example_projects/Balde Eagle Creek/BaldEagle.c01 +0 -0
  47. ras_commander-0.24.0.dev0/examples/example_projects/Balde Eagle Creek/BaldEagle.dss +0 -0
  48. ras_commander-0.24.0.dev0/examples/example_projects/Balde Eagle Creek/BaldEagle.f01 +0 -15463
  49. ras_commander-0.24.0.dev0/examples/example_projects/Balde Eagle Creek/BaldEagle.f02 +0 -44
  50. ras_commander-0.24.0.dev0/examples/example_projects/Balde Eagle Creek/BaldEagle.g01 +0 -8162
  51. ras_commander-0.24.0.dev0/examples/example_projects/Balde Eagle Creek/BaldEagle.g01.gmz +0 -0
  52. ras_commander-0.24.0.dev0/examples/example_projects/Balde Eagle Creek/BaldEagle.g01.hdf +0 -0
  53. ras_commander-0.24.0.dev0/examples/example_projects/Balde Eagle Creek/BaldEagle.gis +0 -4329
  54. ras_commander-0.24.0.dev0/examples/example_projects/Balde Eagle Creek/BaldEagle.p01 +0 -349
  55. ras_commander-0.24.0.dev0/examples/example_projects/Balde Eagle Creek/BaldEagle.p01.comp_msgs.txt +0 -45
  56. ras_commander-0.24.0.dev0/examples/example_projects/Balde Eagle Creek/BaldEagle.p01.computeMsgs.txt +0 -287
  57. ras_commander-0.24.0.dev0/examples/example_projects/Balde Eagle Creek/BaldEagle.p02 +0 -225
  58. ras_commander-0.24.0.dev0/examples/example_projects/Balde Eagle Creek/BaldEagle.p02.computeMsgs.txt +0 -82
  59. ras_commander-0.24.0.dev0/examples/example_projects/Balde Eagle Creek/BaldEagle.prj +0 -32
  60. ras_commander-0.24.0.dev0/examples/example_projects/Balde Eagle Creek/BaldEagle.rasmap +0 -94
  61. ras_commander-0.24.0.dev0/examples/example_projects/Balde Eagle Creek/BaldEagle.u02 +0 -132
  62. ras_commander-0.24.0.dev0/examples/example_projects/Balde Eagle Creek/BaldEagle.u02.hdf +0 -0
  63. ras_commander-0.24.0.dev0/examples/example_projects/Balde Eagle Creek [SpecificSequential]/BaldEagle.b01 +0 -173
  64. ras_commander-0.24.0.dev0/examples/example_projects/Balde Eagle Creek [SpecificSequential]/BaldEagle.c01 +0 -0
  65. ras_commander-0.24.0.dev0/examples/example_projects/Balde Eagle Creek [SpecificSequential]/BaldEagle.dss +0 -0
  66. ras_commander-0.24.0.dev0/examples/example_projects/Balde Eagle Creek [SpecificSequential]/BaldEagle.f01 +0 -15463
  67. ras_commander-0.24.0.dev0/examples/example_projects/Balde Eagle Creek [SpecificSequential]/BaldEagle.f02 +0 -44
  68. ras_commander-0.24.0.dev0/examples/example_projects/Balde Eagle Creek [SpecificSequential]/BaldEagle.g01 +0 -8162
  69. ras_commander-0.24.0.dev0/examples/example_projects/Balde Eagle Creek [SpecificSequential]/BaldEagle.g01.gmz +0 -0
  70. ras_commander-0.24.0.dev0/examples/example_projects/Balde Eagle Creek [SpecificSequential]/BaldEagle.g01.hdf +0 -0
  71. ras_commander-0.24.0.dev0/examples/example_projects/Balde Eagle Creek [SpecificSequential]/BaldEagle.gis +0 -4329
  72. ras_commander-0.24.0.dev0/examples/example_projects/Balde Eagle Creek [SpecificSequential]/BaldEagle.p01 +0 -349
  73. ras_commander-0.24.0.dev0/examples/example_projects/Balde Eagle Creek [SpecificSequential]/BaldEagle.p01.comp_msgs.txt +0 -45
  74. ras_commander-0.24.0.dev0/examples/example_projects/Balde Eagle Creek [SpecificSequential]/BaldEagle.p01.tmp.hdf +0 -0
  75. ras_commander-0.24.0.dev0/examples/example_projects/Balde Eagle Creek [SpecificSequential]/BaldEagle.p02 +0 -225
  76. ras_commander-0.24.0.dev0/examples/example_projects/Balde Eagle Creek [SpecificSequential]/BaldEagle.p02.computeMsgs.txt +0 -82
  77. ras_commander-0.24.0.dev0/examples/example_projects/Balde Eagle Creek [SpecificSequential]/BaldEagle.prj +0 -32
  78. ras_commander-0.24.0.dev0/examples/example_projects/Balde Eagle Creek [SpecificSequential]/BaldEagle.rasmap +0 -94
  79. ras_commander-0.24.0.dev0/examples/example_projects/Balde Eagle Creek [SpecificSequential]/BaldEagle.u02 +0 -132
  80. ras_commander-0.24.0.dev0/examples/example_projects/Balde Eagle Creek [SpecificSequential]/BaldEagle.u02.hdf +0 -0
  81. ras_commander-0.24.0.dev0/examples/example_projects/Balde Eagle Creek [SpecificSequential]/BaldEagle.x01 +0 -8179
  82. ras_commander-0.24.0.dev0/examples/example_projects.ipynb +0 -3509
  83. ras_commander-0.24.0.dev0/examples/xx_edge_cases.py +0 -155
  84. ras_commander-0.24.0.dev0/future_dev_roadmap.ipynb +0 -433
  85. ras_commander-0.24.0.dev0/pyproject.toml +0 -27
  86. ras_commander-0.24.0.dev0/ras_commander/RasPrj.py +0 -400
  87. ras_commander-0.24.0.dev0/ras_commander/RasUtils.py +0 -310
  88. ras_commander-0.24.0.dev0/ras_commander.egg-info/PKG-INFO +0 -201
  89. ras_commander-0.24.0.dev0/ras_commander.egg-info/SOURCES.txt +0 -83
  90. ras_commander-0.24.0.dev0/requirements.txt +0 -32
  91. ras_commander-0.24.0.dev0/setup.py +0 -3
  92. {ras_commander-0.24.0.dev0 → ras_commander-0.34.0}/LICENSE +0 -0
  93. {ras_commander-0.24.0.dev0 → ras_commander-0.34.0}/ras_commander.egg-info/dependency_links.txt +0 -0
  94. {ras_commander-0.24.0.dev0 → ras_commander-0.34.0}/ras_commander.egg-info/top_level.txt +0 -0
@@ -0,0 +1,263 @@
1
+ Metadata-Version: 2.1
2
+ Name: ras-commander
3
+ Version: 0.34.0
4
+ Summary: A Python library for automating HEC-RAS operations
5
+ Home-page: https://github.com/billk-FM/ras-commander
6
+ Author: William M. Katzenmeyer
7
+ Author-email: billk@fenstermaker.com
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.9
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: pandas>=1.0.0
15
+ Requires-Dist: numpy>=1.18.0
16
+ Requires-Dist: h5py>=3.1.0
17
+ Requires-Dist: requests>=2.25.0
18
+ Requires-Dist: pathlib>=1.0.1
19
+ Requires-Dist: scipy>=1.5.0
20
+ Requires-Dist: matplotlib>=3.3.0
21
+ Provides-Extra: dev
22
+ Requires-Dist: pytest>=6.2.0; extra == "dev"
23
+ Requires-Dist: flake8>=3.9.0; extra == "dev"
24
+ Requires-Dist: black>=21.5b1; extra == "dev"
25
+ Requires-Dist: sphinx>=3.5.0; extra == "dev"
26
+ Requires-Dist: sphinx-rtd-theme>=0.5.0; extra == "dev"
27
+ Requires-Dist: twine>=3.3.0; extra == "dev"
28
+
29
+ # RAS Commander (ras-commander)
30
+
31
+ 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).
32
+
33
+ ## Contributors:
34
+ William Katzenmeyer, P.E., C.F.M. - billk@fenstermaker.com
35
+
36
+ Sean Micek, P.E., C.F.M. - smicek@fenstermaker.com
37
+
38
+ Aaron Nichols, P.E., C.F.M. - anichols@fenstermaker.com
39
+
40
+ (Additional Contributors Here)
41
+
42
+
43
+ ## Background
44
+ 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.
45
+
46
+ ## Features
47
+
48
+ - Automate HEC-RAS project management and simulations
49
+ - Support for both single and multiple project instances
50
+ - Parallel execution of HEC-RAS plans
51
+ - Utilities for managing geometry, plan, and unsteady flow files
52
+ - Example project management for testing and development
53
+ - Two primary operation modes: "Run Missing" and "Build from DSS"
54
+
55
+ ## AI-Driven Coding Experience
56
+
57
+ ras-commander provides several AI-powered tools to enhance the coding experience:
58
+
59
+ 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.
60
+
61
+ 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.
62
+
63
+ 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.
64
+ 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.
65
+
66
+ These tools aim to streamline development and provide intelligent assistance when modeling with, and working with and revising the ras-commander library.
67
+
68
+ ## Installation
69
+
70
+ Create a virtual environment with conda or venv (ask ChatGPT if you need help)
71
+
72
+ In your virtual environment, install ras-commander using pip:
73
+ ```
74
+ pip install pandas requests pathlib
75
+ pip install ras-commander
76
+ ```
77
+
78
+
79
+
80
+ ## Requirements
81
+
82
+ - Tested with Python 3.11
83
+ - HEC-RAS 6.2 or later (other versions may work, all testing was done with version 6.2 and above)
84
+ - Detailed project workflows and/or existing libraries and code where ras-commander can be integrated.
85
+
86
+ For a full list of dependencies, see the `requirements.txt` file.
87
+
88
+ ## Quick Start
89
+ ```
90
+ from ras_commander import init_ras_project, RasCmdr, RasPlan
91
+ ```
92
+
93
+ # Initialize a project
94
+ ```
95
+ init_ras_project(r"/path/to/project", "6.5")
96
+ ```
97
+
98
+ # Execute a single plan
99
+ ```
100
+ RasCmdr.compute_plan("01", dest_folder=r"/path/to/results", overwrite_dest=True)
101
+ ```
102
+
103
+ # Execute plans in parallel
104
+ ```
105
+ results = RasCmdr.compute_parallel(
106
+ plan_numbers=["01", "02"],
107
+ max_workers=2,
108
+ cores_per_run=2,
109
+ dest_folder=r"/path/to/results",
110
+ overwrite_dest=True
111
+ )
112
+ ```
113
+
114
+ # Modify a plan
115
+ ```
116
+ RasPlan.set_geom("01", "02")
117
+ ```
118
+
119
+ ## Key Components
120
+
121
+ - `RasPrj`: Manages HEC-RAS projects
122
+ - `RasCmdr`: Handles execution of HEC-RAS simulations
123
+ - `RasPlan`: Provides functions for modifying and updating plan files
124
+ - `RasGeo`: Handles operations related to geometry files
125
+ - `RasUnsteady`: Manages unsteady flow file operations
126
+ - `RasUtils`: Contains utility functions for file operations and data management
127
+ - `RasExamples`: Manages and loads HEC-RAS example projects
128
+
129
+
130
+ ## Project Organization Diagram
131
+ ```
132
+ ras_commander
133
+ ├── .github
134
+ │ └── workflows
135
+ │ └── python-package.yml
136
+ ├── ras_commander
137
+ │ ├── __init__.py
138
+ │ ├── RasCmdr.py
139
+ │ ├── RasExamples.py
140
+ │ ├── RasGeo.py
141
+ │ ├── RasPlan.py
142
+ │ ├── RasPrj.py
143
+ │ ├── RasUnsteady.py
144
+ │ └── RasUtils.py
145
+ ├── examples
146
+ │ ├── 01_project_initialization.py
147
+ │ ├── 02_plan_operations.py
148
+ │ ├── 03_geometry_operations.py
149
+ │ ├── 04_unsteady_flow_operations.py
150
+ │ ├── 05_utility_functions.py
151
+ │ ├── 06_single_plan_execution.py
152
+ │ ├── 07_sequential_plan_execution.py
153
+ │ ├── 08_parallel_execution.py
154
+ │ ├── 09_specifying_plans.py
155
+ │ ├── 10_arguments_for_compute.py
156
+ │ ├── 11_Using_RasExamples.ipynb
157
+ │ ├── 12_plan_set_execution.py
158
+ │ └── 13_multiple_project_operations.py
159
+ ├── tests
160
+ │ └── ... (test files)
161
+ ├── .gitignore
162
+ ├── LICENSE
163
+ ├── README.md
164
+ ├── STYLE_GUIDE.md
165
+ ├── Comprehensive_Library_Guide.md
166
+ ├── pyproject.toml
167
+ ├── setup.cfg
168
+ ├── setup.py
169
+ └── requirements.txt
170
+ ```
171
+
172
+ ## Accessing HEC Examples through RasExamples
173
+
174
+ The `RasExamples` class provides functionality for quickly loading and managing HEC-RAS example projects. This is particularly useful for testing and development purposes.
175
+
176
+ Key features:
177
+ - Download and extract HEC-RAS example projects
178
+ - List available project categories and projects
179
+ - Extract specific projects for use
180
+ - Manage example project data efficiently
181
+
182
+ Example usage:
183
+ from ras_commander import RasExamples
184
+
185
+ ```
186
+ ras_examples = RasExamples()
187
+ ras_examples.get_example_projects() # Downloads example projects if not already present
188
+ categories = ras_examples.list_categories()
189
+ projects = ras_examples.list_projects("Steady Flow")
190
+ extracted_paths = ras_examples.extract_project(["Bald Eagle Creek", "Muncie"])
191
+ ```
192
+
193
+
194
+ ## RasPrj
195
+
196
+ 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.
197
+
198
+ Key features:
199
+ - Initialize HEC-RAS projects
200
+ - Load and manage project data (plans, geometries, flows, etc.)
201
+ - Provide easy access to project files and information
202
+
203
+ Note: While a global `ras` object is available for convenience, you can create multiple `RasPrj` instances to manage several projects simultaneously.
204
+
205
+ Example usage:
206
+ ```
207
+ from ras_commander import RasPrj, init_ras_project
208
+ ```
209
+
210
+ ### Using the global ras object
211
+ ```
212
+ init_ras_project("/path/to/project", "6.5")
213
+ ```
214
+
215
+ ### Creating a custom RasPrj instance
216
+ ```
217
+ custom_project = RasPrj()
218
+ init_ras_project("/path/to/another_project", "6.5", ras_instance=custom_project)
219
+ ```
220
+
221
+ ## Documentation
222
+
223
+ For detailed usage instructions and API documentation, please refer to the [Comprehensive Library Guide](Comprehensive_Library_Guide.md).
224
+
225
+ ## Examples
226
+
227
+ Check out the `examples/` directory for sample scripts demonstrating various features of ras-commander.
228
+
229
+ ## Future Development
230
+
231
+ The ras-commander library is an ongoing project. Future plans include:
232
+ - Integration of more advanced AI-driven features
233
+ - Expansion of HMS and DSS functionalities
234
+ - Enhanced GPU support for computational tasks
235
+ - Community-driven development of new modules and features
236
+
237
+ ## Related Resources
238
+
239
+ - [HEC-Commander Blog](https://github.com/billk-FM/HEC-Commander/tree/main/Blog)
240
+ - [GPT-Commander YouTube Channel](https://www.youtube.com/@GPT_Commander)
241
+ - [ChatGPT Examples for Water Resources Engineers](https://github.com/billk-FM/HEC-Commander/tree/main/ChatGPT%20Examples)
242
+
243
+
244
+ ## Contributing
245
+
246
+ We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details on how to submit pull requests, report issues, and suggest improvements.
247
+
248
+ ## Style Guide
249
+
250
+ This project follows a specific style guide to maintain consistency across the codebase. Please refer to the [Style Guide](STYLE_GUIDE.md) for details on coding conventions, documentation standards, and best practices.
251
+
252
+ ## License
253
+
254
+ ras-commander is released under the MIT License. See the license file for details.
255
+
256
+ ## Acknowledgments
257
+
258
+ RAS Commander is based on the HEC-Commander project's "Command Line is All You Need" approach, leveraging the HEC-RAS command-line interface for automation. The initial development of this library was presented in the HEC-Commander Tools repository. In a 2024 Australian Water School webinar, Bill demonstrated the derivation of basic HEC-RAS automation functions from plain language instructions. Leveraging the previously developed code and AI tools, the library was created. The primary tools used for this initial development were Anthropic's Claude, GPT-4o, Google's Gemini Experimental models, and the Cursor AI Coding IDE.
259
+
260
+ ## Contact
261
+
262
+ For questions, suggestions, or support, please contact:
263
+ William Katzenmeyer, P.E., C.F.M. - billk@fenstermaker.com
@@ -0,0 +1,235 @@
1
+ # RAS Commander (ras-commander)
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).
4
+
5
+ ## Contributors:
6
+ William Katzenmeyer, P.E., C.F.M. - billk@fenstermaker.com
7
+
8
+ Sean Micek, P.E., C.F.M. - smicek@fenstermaker.com
9
+
10
+ Aaron Nichols, P.E., C.F.M. - anichols@fenstermaker.com
11
+
12
+ (Additional Contributors Here)
13
+
14
+
15
+ ## Background
16
+ 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.
17
+
18
+ ## Features
19
+
20
+ - Automate HEC-RAS project management and simulations
21
+ - Support for both single and multiple project instances
22
+ - Parallel execution of HEC-RAS plans
23
+ - Utilities for managing geometry, plan, and unsteady flow files
24
+ - Example project management for testing and development
25
+ - Two primary operation modes: "Run Missing" and "Build from DSS"
26
+
27
+ ## AI-Driven Coding Experience
28
+
29
+ ras-commander provides several AI-powered tools to enhance the coding experience:
30
+
31
+ 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.
32
+
33
+ 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.
34
+
35
+ 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.
36
+ 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.
37
+
38
+ These tools aim to streamline development and provide intelligent assistance when modeling with, and working with and revising the ras-commander library.
39
+
40
+ ## Installation
41
+
42
+ Create a virtual environment with conda or venv (ask ChatGPT if you need help)
43
+
44
+ In your virtual environment, install ras-commander using pip:
45
+ ```
46
+ pip install pandas requests pathlib
47
+ pip install ras-commander
48
+ ```
49
+
50
+
51
+
52
+ ## Requirements
53
+
54
+ - Tested with Python 3.11
55
+ - HEC-RAS 6.2 or later (other versions may work, all testing was done with version 6.2 and above)
56
+ - Detailed project workflows and/or existing libraries and code where ras-commander can be integrated.
57
+
58
+ For a full list of dependencies, see the `requirements.txt` file.
59
+
60
+ ## Quick Start
61
+ ```
62
+ from ras_commander import init_ras_project, RasCmdr, RasPlan
63
+ ```
64
+
65
+ # Initialize a project
66
+ ```
67
+ init_ras_project(r"/path/to/project", "6.5")
68
+ ```
69
+
70
+ # Execute a single plan
71
+ ```
72
+ RasCmdr.compute_plan("01", dest_folder=r"/path/to/results", overwrite_dest=True)
73
+ ```
74
+
75
+ # Execute plans in parallel
76
+ ```
77
+ results = RasCmdr.compute_parallel(
78
+ plan_numbers=["01", "02"],
79
+ max_workers=2,
80
+ cores_per_run=2,
81
+ dest_folder=r"/path/to/results",
82
+ overwrite_dest=True
83
+ )
84
+ ```
85
+
86
+ # Modify a plan
87
+ ```
88
+ RasPlan.set_geom("01", "02")
89
+ ```
90
+
91
+ ## Key Components
92
+
93
+ - `RasPrj`: Manages HEC-RAS projects
94
+ - `RasCmdr`: Handles execution of HEC-RAS simulations
95
+ - `RasPlan`: Provides functions for modifying and updating plan files
96
+ - `RasGeo`: Handles operations related to geometry files
97
+ - `RasUnsteady`: Manages unsteady flow file operations
98
+ - `RasUtils`: Contains utility functions for file operations and data management
99
+ - `RasExamples`: Manages and loads HEC-RAS example projects
100
+
101
+
102
+ ## Project Organization Diagram
103
+ ```
104
+ ras_commander
105
+ ├── .github
106
+ │ └── workflows
107
+ │ └── python-package.yml
108
+ ├── ras_commander
109
+ │ ├── __init__.py
110
+ │ ├── RasCmdr.py
111
+ │ ├── RasExamples.py
112
+ │ ├── RasGeo.py
113
+ │ ├── RasPlan.py
114
+ │ ├── RasPrj.py
115
+ │ ├── RasUnsteady.py
116
+ │ └── RasUtils.py
117
+ ├── examples
118
+ │ ├── 01_project_initialization.py
119
+ │ ├── 02_plan_operations.py
120
+ │ ├── 03_geometry_operations.py
121
+ │ ├── 04_unsteady_flow_operations.py
122
+ │ ├── 05_utility_functions.py
123
+ │ ├── 06_single_plan_execution.py
124
+ │ ├── 07_sequential_plan_execution.py
125
+ │ ├── 08_parallel_execution.py
126
+ │ ├── 09_specifying_plans.py
127
+ │ ├── 10_arguments_for_compute.py
128
+ │ ├── 11_Using_RasExamples.ipynb
129
+ │ ├── 12_plan_set_execution.py
130
+ │ └── 13_multiple_project_operations.py
131
+ ├── tests
132
+ │ └── ... (test files)
133
+ ├── .gitignore
134
+ ├── LICENSE
135
+ ├── README.md
136
+ ├── STYLE_GUIDE.md
137
+ ├── Comprehensive_Library_Guide.md
138
+ ├── pyproject.toml
139
+ ├── setup.cfg
140
+ ├── setup.py
141
+ └── requirements.txt
142
+ ```
143
+
144
+ ## Accessing HEC Examples through RasExamples
145
+
146
+ The `RasExamples` class provides functionality for quickly loading and managing HEC-RAS example projects. This is particularly useful for testing and development purposes.
147
+
148
+ Key features:
149
+ - Download and extract HEC-RAS example projects
150
+ - List available project categories and projects
151
+ - Extract specific projects for use
152
+ - Manage example project data efficiently
153
+
154
+ Example usage:
155
+ from ras_commander import RasExamples
156
+
157
+ ```
158
+ ras_examples = RasExamples()
159
+ ras_examples.get_example_projects() # Downloads example projects if not already present
160
+ categories = ras_examples.list_categories()
161
+ projects = ras_examples.list_projects("Steady Flow")
162
+ extracted_paths = ras_examples.extract_project(["Bald Eagle Creek", "Muncie"])
163
+ ```
164
+
165
+
166
+ ## RasPrj
167
+
168
+ 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.
169
+
170
+ Key features:
171
+ - Initialize HEC-RAS projects
172
+ - Load and manage project data (plans, geometries, flows, etc.)
173
+ - Provide easy access to project files and information
174
+
175
+ Note: While a global `ras` object is available for convenience, you can create multiple `RasPrj` instances to manage several projects simultaneously.
176
+
177
+ Example usage:
178
+ ```
179
+ from ras_commander import RasPrj, init_ras_project
180
+ ```
181
+
182
+ ### Using the global ras object
183
+ ```
184
+ init_ras_project("/path/to/project", "6.5")
185
+ ```
186
+
187
+ ### Creating a custom RasPrj instance
188
+ ```
189
+ custom_project = RasPrj()
190
+ init_ras_project("/path/to/another_project", "6.5", ras_instance=custom_project)
191
+ ```
192
+
193
+ ## Documentation
194
+
195
+ For detailed usage instructions and API documentation, please refer to the [Comprehensive Library Guide](Comprehensive_Library_Guide.md).
196
+
197
+ ## Examples
198
+
199
+ Check out the `examples/` directory for sample scripts demonstrating various features of ras-commander.
200
+
201
+ ## Future Development
202
+
203
+ The ras-commander library is an ongoing project. Future plans include:
204
+ - Integration of more advanced AI-driven features
205
+ - Expansion of HMS and DSS functionalities
206
+ - Enhanced GPU support for computational tasks
207
+ - Community-driven development of new modules and features
208
+
209
+ ## Related Resources
210
+
211
+ - [HEC-Commander Blog](https://github.com/billk-FM/HEC-Commander/tree/main/Blog)
212
+ - [GPT-Commander YouTube Channel](https://www.youtube.com/@GPT_Commander)
213
+ - [ChatGPT Examples for Water Resources Engineers](https://github.com/billk-FM/HEC-Commander/tree/main/ChatGPT%20Examples)
214
+
215
+
216
+ ## Contributing
217
+
218
+ We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details on how to submit pull requests, report issues, and suggest improvements.
219
+
220
+ ## Style Guide
221
+
222
+ This project follows a specific style guide to maintain consistency across the codebase. Please refer to the [Style Guide](STYLE_GUIDE.md) for details on coding conventions, documentation standards, and best practices.
223
+
224
+ ## License
225
+
226
+ ras-commander is released under the MIT License. See the license file for details.
227
+
228
+ ## Acknowledgments
229
+
230
+ RAS Commander is based on the HEC-Commander project's "Command Line is All You Need" approach, leveraging the HEC-RAS command-line interface for automation. The initial development of this library was presented in the HEC-Commander Tools repository. In a 2024 Australian Water School webinar, Bill demonstrated the derivation of basic HEC-RAS automation functions from plain language instructions. Leveraging the previously developed code and AI tools, the library was created. The primary tools used for this initial development were Anthropic's Claude, GPT-4o, Google's Gemini Experimental models, and the Cursor AI Coding IDE.
231
+
232
+ ## Contact
233
+
234
+ For questions, suggestions, or support, please contact:
235
+ William Katzenmeyer, P.E., C.F.M. - billk@fenstermaker.com
@@ -0,0 +1,3 @@
1
+ [build-system]
2
+ requires = ["setuptools>=45", "wheel"]
3
+ build-backend = "setuptools.build_meta:__legacy__"