ras-commander 0.21.0__tar.gz → 0.22.0.dev0__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.21.0 → ras_commander-0.22.0.dev0}/PKG-INFO +40 -164
- {ras_commander-0.21.0 → ras_commander-0.22.0.dev0}/README.md +39 -163
- ras_commander-0.22.0.dev0/ai_tools/README.md +3 -0
- ras_commander-0.22.0.dev0/ai_tools/llmsummarize 1. full repo.py +66 -0
- ras_commander-0.22.0.dev0/ai_tools/llmsummarize 2. docs and code only.py +66 -0
- ras_commander-0.22.0.dev0/ai_tools/llmsummarize 3. documentation and docstrings.py +80 -0
- ras_commander-0.22.0.dev0/ai_tools/rascommander_code_assistant.ipynb +760 -0
- {ras_commander-0.21.0 → ras_commander-0.22.0.dev0}/examples/01_project_initialization.py +1 -1
- {ras_commander-0.21.0 → ras_commander-0.22.0.dev0}/examples/02_plan_operations.py +13 -1
- {ras_commander-0.21.0 → ras_commander-0.22.0.dev0}/examples/03_geometry_operations.py +13 -1
- ras_commander-0.22.0.dev0/examples/example_projects.ipynb +372 -0
- ras_commander-0.22.0.dev0/future_dev_roadmap.ipynb +433 -0
- ras_commander-0.22.0.dev0/misc/Claude Example Error Correct Suggestions.txt +278 -0
- ras_commander-0.22.0.dev0/misc/FunctionList.md +0 -0
- ras_commander-0.22.0.dev0/misc/Gemini Code Review.ipynb +1830 -0
- ras_commander-0.22.0.dev0/misc/Gemini Dev notes.ipynb +75 -0
- ras_commander-0.22.0.dev0/misc/PEP 484.txt +2493 -0
- ras_commander-0.22.0.dev0/misc/Plan Key Notes.txt +161 -0
- ras_commander-0.22.0.dev0/misc/Prompts.txt +370 -0
- ras_commander-0.22.0.dev0/misc/future examples/xx_accessing_hdf_results_1D.py +1 -0
- ras_commander-0.22.0.dev0/misc/future examples/xx_accessing_hdf_results_2D.py +1 -0
- ras_commander-0.22.0.dev0/misc/future examples/xx_changing_2d_infiltration_overrides.ipynb +0 -0
- ras_commander-0.22.0.dev0/misc/future examples/xx_changing_2d_mannings_tables.ipynb +0 -0
- ras_commander-0.22.0.dev0/misc/future examples/xx_changing_common_plan_keys.ipynb +0 -0
- ras_commander-0.22.0.dev0/misc/future examples/xx_changing_common_unsteady_keys.ipynb +0 -0
- ras_commander-0.22.0.dev0/misc/future examples/xx_compute_remote_desktop.py +0 -0
- ras_commander-0.22.0.dev0/misc/future_dev_roadmap.ipynb +433 -0
- ras_commander-0.22.0.dev0/misc/magic example project lines.txt +3 -0
- ras_commander-0.22.0.dev0/misc/pep 8.txt +1647 -0
- ras_commander-0.22.0.dev0/python +0 -0
- {ras_commander-0.21.0 → ras_commander-0.22.0.dev0}/ras_commander/RasCommander.py +21 -12
- {ras_commander-0.21.0 → ras_commander-0.22.0.dev0}/ras_commander/RasGeo.py +8 -3
- {ras_commander-0.21.0 → ras_commander-0.22.0.dev0}/ras_commander/RasPlan.py +73 -23
- {ras_commander-0.21.0 → ras_commander-0.22.0.dev0}/ras_commander/RasUnsteady.py +15 -4
- {ras_commander-0.21.0 → ras_commander-0.22.0.dev0}/ras_commander/RasUtils.py +36 -9
- ras_commander-0.22.0.dev0/ras_commander/_version.py +16 -0
- {ras_commander-0.21.0 → ras_commander-0.22.0.dev0}/ras_commander.egg-info/PKG-INFO +40 -164
- {ras_commander-0.21.0 → ras_commander-0.22.0.dev0}/ras_commander.egg-info/SOURCES.txt +27 -3
- ras_commander-0.22.0.dev0/setup.py +3 -0
- ras_commander-0.22.0.dev0/updated_pyproject.toml +25 -0
- ras_commander-0.21.0/dist/ras_commander-0.21.0-py2.py3-none-any.whl +0 -0
- ras_commander-0.21.0/dist/ras_commander-0.21.0.tar.gz +0 -0
- ras_commander-0.21.0/examples/example_projects.ipynb +0 -1345
- ras_commander-0.21.0/setup.py +0 -7
- /ras_commander-0.21.0/.cursorrules.txt → /ras_commander-0.22.0.dev0/.cursorrules +0 -0
- {ras_commander-0.21.0 → ras_commander-0.22.0.dev0}/.github/workflows/publish-to-pypi.yml +0 -0
- {ras_commander-0.21.0 → ras_commander-0.22.0.dev0}/.gitignore/.gitignore +0 -0
- {ras_commander-0.21.0 → ras_commander-0.22.0.dev0}/Comprehensive_Library_Guide.md +0 -0
- {ras_commander-0.21.0 → ras_commander-0.22.0.dev0}/LICENSE +0 -0
- {ras_commander-0.21.0 → ras_commander-0.22.0.dev0}/STYLE_GUIDE.md +0 -0
- {ras_commander-0.21.0 → ras_commander-0.22.0.dev0}/examples/04_unsteady_flow_operations.py +0 -0
- {ras_commander-0.21.0 → ras_commander-0.22.0.dev0}/examples/05_utility_functions.py +0 -0
- {ras_commander-0.21.0 → ras_commander-0.22.0.dev0}/examples/06_single_plan_execution.py +0 -0
- {ras_commander-0.21.0 → ras_commander-0.22.0.dev0}/examples/07_sequential_plan_execution.py +0 -0
- {ras_commander-0.21.0 → ras_commander-0.22.0.dev0}/examples/08_parallel_execution.py +0 -0
- {ras_commander-0.21.0 → ras_commander-0.22.0.dev0}/examples/09_specifying_plans.py +0 -0
- {ras_commander-0.21.0 → ras_commander-0.22.0.dev0}/examples/10_arguments_for_compute.py +0 -0
- {ras_commander-0.21.0 → ras_commander-0.22.0.dev0}/examples/11_Using_RasExamples.ipynb +0 -0
- {ras_commander-0.21.0 → ras_commander-0.22.0.dev0}/examples/12_plan_set_execution.py +0 -0
- {ras_commander-0.21.0 → ras_commander-0.22.0.dev0}/examples/13_multiple_project_operations.py +0 -0
- {ras_commander-0.21.0 → ras_commander-0.22.0.dev0}/examples/example_projects.csv +0 -0
- {ras_commander-0.21.0 → ras_commander-0.22.0.dev0}/pyproject.toml +0 -0
- {ras_commander-0.21.0 → ras_commander-0.22.0.dev0}/ras_commander/README.md +0 -0
- {ras_commander-0.21.0 → ras_commander-0.22.0.dev0}/ras_commander/RasExamples.py +0 -0
- {ras_commander-0.21.0 → ras_commander-0.22.0.dev0}/ras_commander/RasPrj.py +0 -0
- {ras_commander-0.21.0 → ras_commander-0.22.0.dev0}/ras_commander/__init__.py +0 -0
- {ras_commander-0.21.0 → ras_commander-0.22.0.dev0}/ras_commander.egg-info/dependency_links.txt +0 -0
- {ras_commander-0.21.0 → ras_commander-0.22.0.dev0}/ras_commander.egg-info/top_level.txt +0 -0
- {ras_commander-0.21.0 → ras_commander-0.22.0.dev0}/requirements.txt +0 -0
- {ras_commander-0.21.0 → ras_commander-0.22.0.dev0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: ras_commander
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.22.0.dev0
|
4
4
|
Summary: A library for automating HEC-RAS operations using python functions.
|
5
5
|
Author-email: "William Katzenmeyer, P.E., C.F.M." <heccommander@gmail.com>
|
6
6
|
Project-URL: Homepage, https://github.com/yourusername/ras_commander
|
@@ -11,164 +11,7 @@ Requires-Python: >=3.9
|
|
11
11
|
Description-Content-Type: text/markdown
|
12
12
|
License-File: LICENSE
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
| Directory/File | Purpose |
|
17
|
-
|---|---|
|
18
|
-
| ras_commander/__init__.py | Initializes the library and defines the public API. |
|
19
|
-
| ras_commander/RasCommander.py | Handles execution of HEC-RAS simulations. |
|
20
|
-
| ras_commander/RasFileOps.py | Provides functions for reading and parsing HEC-RAS project files. |
|
21
|
-
| ras_commander/RasGeo.py | Provides functions for manipulating geometry files. |
|
22
|
-
| ras_commander/RasPlan.py | Provides functions for modifying and updating plan files. |
|
23
|
-
| ras_commander/RasPrj.py | Defines the RasPrj class for managing project-level information. |
|
24
|
-
| ras_commander/rasinit.py | Provides the `init_ras_project` function to initialize a project. |
|
25
|
-
| ras_commander/RasPrj.py | Provides functions for managing HEC-RAS projects (e.g., copying files, updating project file). |
|
26
|
-
| ras_commander/RasUnsteady.py | Provides functions for manipulating unsteady flow files. |
|
27
|
-
| ras_commander/RasUtils.py | Provides general utility functions (e.g., file backup, directory creation). |
|
28
|
-
|
29
|
-
## Project Organization Diagram
|
30
|
-
|
31
|
-
```
|
32
|
-
ras_commander
|
33
|
-
├── .github
|
34
|
-
│ └── workflows
|
35
|
-
│ └── python-package.yml
|
36
|
-
├── ras_commander
|
37
|
-
│ ├── __init__.py
|
38
|
-
│ ├── RasCommander.py
|
39
|
-
│ ├── RasFileOps.py
|
40
|
-
│ ├── RasGeo.py
|
41
|
-
│ ├── RasPlan.py
|
42
|
-
│ ├── RasPrj.py
|
43
|
-
│ ├── rasinit.py
|
44
|
-
│ ├── RasPrj.py
|
45
|
-
│ ├── RasUnsteady.py
|
46
|
-
│ └── RasUtils.py
|
47
|
-
├── tests
|
48
|
-
│ └── ... (test files)
|
49
|
-
├── .gitignore
|
50
|
-
├── LICENSE
|
51
|
-
├── README.md
|
52
|
-
├── pyproject.toml
|
53
|
-
├── setup.cfg
|
54
|
-
└── setup.py
|
55
|
-
```
|
56
|
-
|
57
|
-
## Functions Overview
|
58
|
-
|
59
|
-
| Function | Arguments | Purpose |
|
60
|
-
|---|---|---|
|
61
|
-
| `init_ras_project` | `ras_project_folder`, `ras_exe_path` | Initializes a HEC-RAS project by setting up the `RasPrj` with project details. |
|
62
|
-
| `compute_plan` | `plan_file` | Executes a HEC-RAS plan file. |
|
63
|
-
| `compute_plan_from_folder` | `test_plan_file`, `test_folder_path` | Execute a single HEC-RAS plan from a folder other than the project path. |
|
64
|
-
| `compute_test_mode` | `project_folder` | Recreates the -test function from the HEC-RAS interface, primarily by copying the project directory, forcing recomputation, and running each plan. |
|
65
|
-
| `compute_parallel` | `config`, `max_workers`, `cores_per_run` | Run HEC-RAS plans in parallel. |
|
66
|
-
| `compute_parallel_all` | `project_folder`, `ras_exe_path` | Run all HEC-RAS plans in parallel from a project folder path. |
|
67
|
-
|
68
|
-
[The rest of the function list remains the same, just ensure the class names are updated to their new lowercase versions]
|
69
|
-
|
70
|
-
## Potential Uses of RAS-Commander Functions
|
71
|
-
|
72
|
-
[This section remains unchanged]
|
73
|
-
|
74
|
-
## GitHub Actions
|
75
|
-
|
76
|
-
[This section remains unchanged]
|
77
|
-
|
78
|
-
## Basic Usage Instructions
|
79
|
-
|
80
|
-
To get started with RAS-Commander, follow these steps:
|
81
|
-
|
82
|
-
1. Install the library:
|
83
|
-
```
|
84
|
-
pip install ras-commander
|
85
|
-
```
|
86
|
-
|
87
|
-
2. Import the necessary modules:
|
88
|
-
```python
|
89
|
-
from ras_commander import rasinit, RasFileOps, RasPrj, RasPlan, RasGeo, RasUnsteady, RasCommander, RasUtils
|
90
|
-
```
|
91
|
-
|
92
|
-
3. Initialize a HEC-RAS project:
|
93
|
-
```python
|
94
|
-
project_folder = r"C:\path\to\your\project"
|
95
|
-
ras_exe_path = r"C:\Program Files (x86)\HEC\HEC-RAS\6.5\Ras.exe"
|
96
|
-
config = rasinit(project_folder, ras_exe_path)
|
97
|
-
```
|
98
|
-
|
99
|
-
4. Perform operations on your HEC-RAS project. For example:
|
100
|
-
|
101
|
-
- Execute a single plan:
|
102
|
-
```python
|
103
|
-
plan_file = RasPlan.get_plan_path("01")
|
104
|
-
RasCommander.compute_plan(plan_file)
|
105
|
-
```
|
106
|
-
|
107
|
-
- Run multiple plans in parallel:
|
108
|
-
```python
|
109
|
-
max_workers = 2
|
110
|
-
cores_per_run = 1
|
111
|
-
results = RasCommander.compute_parallel(config, max_workers, cores_per_run)
|
112
|
-
```
|
113
|
-
|
114
|
-
- Copy and modify geometry files:
|
115
|
-
```python
|
116
|
-
RasGeo.clone_geom(config.project_folder, "01")
|
117
|
-
plan_file = RasPlan.get_plan_path("01")
|
118
|
-
RasGeo.set_geom(plan_file, "02")
|
119
|
-
```
|
120
|
-
|
121
|
-
- Work with unsteady flow files:
|
122
|
-
```python
|
123
|
-
new_unsteady_number = RasUnsteady.clone_unsteady(config.project_folder, "01")
|
124
|
-
plan_file = RasPlan.get_plan_path("01")
|
125
|
-
RasUnsteady.set_unsteady(plan_file, new_unsteady_number)
|
126
|
-
```
|
127
|
-
|
128
|
-
5. Access project information:
|
129
|
-
```python
|
130
|
-
print(f"Project name: {config.project_name}")
|
131
|
-
print(f"Project file: {config.prj_file}")
|
132
|
-
print(f"Project folder: {config.project_folder}")
|
133
|
-
```
|
134
|
-
|
135
|
-
For more detailed examples and advanced usage, refer to the function documentation and the examples provided in the repository.
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
NOTES: INCORPORATE INTO THE README.MD FILE ABOVE UNDER A NEW SECTION FOR CURRENT USES AND ROADMAP ITEMS, THEN DELETE THIS NOTE
|
141
|
-
|
142
|
-
|
143
|
-
Potential Uses of HEC-RAS Automation Functions
|
144
|
-
This set of functions provides a powerful foundation for automating various aspects of HEC-RAS modeling workflows. Here are some potential applications:
|
145
|
-
1. Calibration and Sensitivity Analysis:
|
146
|
-
Automated Parameter Variation: Users can create multiple simulation scenarios with varying parameters (e.g., Manning's n values, boundary conditions, initial conditions) to calibrate their model against observed data.
|
147
|
-
Sensitivity Testing: Evaluate the impact of different input parameters on model outputs by generating a range of scenarios and analyzing the results. This helps identify critical parameters that require more attention during calibration.
|
148
|
-
2. Real-time Forecasting:
|
149
|
-
Dynamic Model Updates: Integrate with external data sources (e.g., weather forecasts, streamflow observations) to automatically update boundary conditions and initial conditions in unsteady flow files before running the simulation.
|
150
|
-
Ensemble Forecasting: Generate multiple forecasts by incorporating uncertainty in input data and model parameters. This provides a more comprehensive understanding of potential future flow conditions.
|
151
|
-
3. Scenario Analysis:
|
152
|
-
Land Use Change Impacts: Evaluate the effects of land use changes on flood risk by modifying Manning's n values using extract_2d_mannings_tables, modify_2d_mannings_table, and write_2d_mannings_tables and running simulations with updated geometry files.
|
153
|
-
Climate Change Impacts: Analyze the potential impacts of projected climate changes on flood risk by adjusting precipitation patterns and other relevant parameters in unsteady flow files.
|
154
|
-
4. Batch Processing and High-Performance Computing:
|
155
|
-
Large-scale Model Runs: Utilize run_plans_parallel to execute multiple simulations concurrently on a multi-core system, significantly reducing processing time for large-scale models or complex scenarios.
|
156
|
-
Automated Report Generation: Integrate with Python libraries like matplotlib and bokeh to automatically generate customized reports summarizing simulation results, including tables, figures, and maps.
|
157
|
-
5. Model Development and Testing:
|
158
|
-
Rapid Prototyping: Quickly set up and run new model configurations using template files and automated workflows, facilitating rapid model development and testing.
|
159
|
-
Regression Testing: Ensure model integrity and consistency after code changes or updates by automatically running a predefined set of simulations and comparing results with expected outputs.
|
160
|
-
6. User-Friendly Interfaces:
|
161
|
-
GUI Development: Integrate with Python GUI libraries like Tkinter or PyQt to create user-friendly interfaces for automating HEC-RAS workflows, allowing non-programmers to access the power of automation.
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
Certainly! I'll create an updated README.md for the ras_commander library, incorporating the information you've provided and the context from the previous HEC-Commander tools. Here's the updated README.md:
|
169
|
-
|
170
|
-
```markdown
|
171
|
-
# ras_commander
|
14
|
+
# RAS-Commander (ras_commander)
|
172
15
|
|
173
16
|
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 RAS-Commander 1.0 Python Notebook Application previously released under the HEC-Commander tools.
|
174
17
|
|
@@ -186,13 +29,13 @@ ras_commander is a Python library for automating HEC-RAS operations, providing a
|
|
186
29
|
Install ras_commander using pip:
|
187
30
|
|
188
31
|
```bash
|
189
|
-
pip install
|
32
|
+
pip install ras-commander
|
190
33
|
```
|
191
34
|
|
192
35
|
## Requirements
|
193
36
|
|
194
37
|
- Python 3.9+
|
195
|
-
- HEC-RAS 6.
|
38
|
+
- HEC-RAS 6.2 or later (other versions may work, all testing was done with version 6.2 and above)
|
196
39
|
|
197
40
|
For a full list of dependencies, see the `requirements.txt` file.
|
198
41
|
|
@@ -297,9 +140,10 @@ ras_commander
|
|
297
140
|
├── setup.cfg
|
298
141
|
├── setup.py
|
299
142
|
└── requirements.txt
|
143
|
+
```
|
300
144
|
|
301
145
|
|
302
|
-
## Inclusion of .cursorrules for AI-driven Coding Experience
|
146
|
+
## Inclusion of .cursorrules and ai_tools for AI-driven Coding Experience
|
303
147
|
|
304
148
|
Open the ras_commander folder in the Cursor IDE, and it will automatically include the .cursorrules file in your instructions. Additionally, two other provided methods for interacting with the library though your current AI subscriptions:
|
305
149
|
|
@@ -308,6 +152,7 @@ Open the ras_commander folder in the Cursor IDE, and it will automatically inclu
|
|
308
152
|
- Entire code base: LINK HERE (TOKEN COUNT) (for Claude or Gemini)
|
309
153
|
- Examples and Function Docstrings Only: LINK HERE (TOKEN COUNT) (for GPT-4o, o1 or Llama 3.1 405b)
|
310
154
|
- Cursor IDE through .cursorrules file
|
155
|
+
- 'rascommander_code_assistant.ipynb' notebook in the ras_commander folder, which allows for dynamic summarization of the code base and API chatting directly through the notebook.
|
311
156
|
|
312
157
|
There are a series of scripts provided in the "llm_summaries" folder that provide summaries of the code base, and the docstrings of the functions. They can be run in your local environment, or provided to ChatGPT's code interpreter for execution.
|
313
158
|
|
@@ -324,8 +169,6 @@ We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) f
|
|
324
169
|
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.
|
325
170
|
|
326
171
|
|
327
|
-
|
328
|
-
|
329
172
|
## License
|
330
173
|
|
331
174
|
ras_commander is released under the MIT License. See the license file for details.
|
@@ -340,3 +183,36 @@ ras_commander is based on the HEC-Commander project's "Command Line is All You N
|
|
340
183
|
|
341
184
|
For questions, suggestions, or support, please contact:
|
342
185
|
William Katzenmeyer, P.E., C.F.M. - billk@fenstermaker.com
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
NOTES: INCORPORATE INTO THE README.MD FILE ABOVE UNDER A NEW SECTION FOR CURRENT USES AND ROADMAP ITEMS, THEN DELETE THIS NOTE
|
196
|
+
|
197
|
+
|
198
|
+
Potential Uses of HEC-RAS Automation Functions
|
199
|
+
This set of functions provides a powerful foundation for automating various aspects of HEC-RAS modeling workflows. Here are some potential applications:
|
200
|
+
1. Calibration and Sensitivity Analysis:
|
201
|
+
Automated Parameter Variation: Users can create multiple simulation scenarios with varying parameters (e.g., Manning's n values, boundary conditions, initial conditions) to calibrate their model against observed data.
|
202
|
+
Sensitivity Testing: Evaluate the impact of different input parameters on model outputs by generating a range of scenarios and analyzing the results. This helps identify critical parameters that require more attention during calibration.
|
203
|
+
2. Real-time Forecasting:
|
204
|
+
Dynamic Model Updates: Integrate with external data sources (e.g., weather forecasts, streamflow observations) to automatically update boundary conditions and initial conditions in unsteady flow files before running the simulation.
|
205
|
+
Ensemble Forecasting: Generate multiple forecasts by incorporating uncertainty in input data and model parameters. This provides a more comprehensive understanding of potential future flow conditions.
|
206
|
+
3. Scenario Analysis:
|
207
|
+
Land Use Change Impacts: Evaluate the effects of land use changes on flood risk by modifying Manning's n values using extract_2d_mannings_tables, modify_2d_mannings_table, and write_2d_mannings_tables and running simulations with updated geometry files.
|
208
|
+
Climate Change Impacts: Analyze the potential impacts of projected climate changes on flood risk by adjusting precipitation patterns and other relevant parameters in unsteady flow files.
|
209
|
+
4. Batch Processing and High-Performance Computing:
|
210
|
+
Large-scale Model Runs: Utilize run_plans_parallel to execute multiple simulations concurrently on a multi-core system, significantly reducing processing time for large-scale models or complex scenarios.
|
211
|
+
Automated Report Generation: Integrate with Python libraries like matplotlib and bokeh to automatically generate customized reports summarizing simulation results, including tables, figures, and maps.
|
212
|
+
5. Model Development and Testing:
|
213
|
+
Rapid Prototyping: Quickly set up and run new model configurations using template files and automated workflows, facilitating rapid model development and testing.
|
214
|
+
Regression Testing: Ensure model integrity and consistency after code changes or updates by automatically running a predefined set of simulations and comparing results with expected outputs.
|
215
|
+
6. User-Friendly Interfaces:
|
216
|
+
GUI Development: Integrate with Python GUI libraries like Tkinter or PyQt to create user-friendly interfaces for automating HEC-RAS workflows, allowing non-programmers to access the power of automation.
|
217
|
+
|
218
|
+
|
@@ -1,161 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
| Directory/File | Purpose |
|
4
|
-
|---|---|
|
5
|
-
| ras_commander/__init__.py | Initializes the library and defines the public API. |
|
6
|
-
| ras_commander/RasCommander.py | Handles execution of HEC-RAS simulations. |
|
7
|
-
| ras_commander/RasFileOps.py | Provides functions for reading and parsing HEC-RAS project files. |
|
8
|
-
| ras_commander/RasGeo.py | Provides functions for manipulating geometry files. |
|
9
|
-
| ras_commander/RasPlan.py | Provides functions for modifying and updating plan files. |
|
10
|
-
| ras_commander/RasPrj.py | Defines the RasPrj class for managing project-level information. |
|
11
|
-
| ras_commander/rasinit.py | Provides the `init_ras_project` function to initialize a project. |
|
12
|
-
| ras_commander/RasPrj.py | Provides functions for managing HEC-RAS projects (e.g., copying files, updating project file). |
|
13
|
-
| ras_commander/RasUnsteady.py | Provides functions for manipulating unsteady flow files. |
|
14
|
-
| ras_commander/RasUtils.py | Provides general utility functions (e.g., file backup, directory creation). |
|
15
|
-
|
16
|
-
## Project Organization Diagram
|
17
|
-
|
18
|
-
```
|
19
|
-
ras_commander
|
20
|
-
├── .github
|
21
|
-
│ └── workflows
|
22
|
-
│ └── python-package.yml
|
23
|
-
├── ras_commander
|
24
|
-
│ ├── __init__.py
|
25
|
-
│ ├── RasCommander.py
|
26
|
-
│ ├── RasFileOps.py
|
27
|
-
│ ├── RasGeo.py
|
28
|
-
│ ├── RasPlan.py
|
29
|
-
│ ├── RasPrj.py
|
30
|
-
│ ├── rasinit.py
|
31
|
-
│ ├── RasPrj.py
|
32
|
-
│ ├── RasUnsteady.py
|
33
|
-
│ └── RasUtils.py
|
34
|
-
├── tests
|
35
|
-
│ └── ... (test files)
|
36
|
-
├── .gitignore
|
37
|
-
├── LICENSE
|
38
|
-
├── README.md
|
39
|
-
├── pyproject.toml
|
40
|
-
├── setup.cfg
|
41
|
-
└── setup.py
|
42
|
-
```
|
43
|
-
|
44
|
-
## Functions Overview
|
45
|
-
|
46
|
-
| Function | Arguments | Purpose |
|
47
|
-
|---|---|---|
|
48
|
-
| `init_ras_project` | `ras_project_folder`, `ras_exe_path` | Initializes a HEC-RAS project by setting up the `RasPrj` with project details. |
|
49
|
-
| `compute_plan` | `plan_file` | Executes a HEC-RAS plan file. |
|
50
|
-
| `compute_plan_from_folder` | `test_plan_file`, `test_folder_path` | Execute a single HEC-RAS plan from a folder other than the project path. |
|
51
|
-
| `compute_test_mode` | `project_folder` | Recreates the -test function from the HEC-RAS interface, primarily by copying the project directory, forcing recomputation, and running each plan. |
|
52
|
-
| `compute_parallel` | `config`, `max_workers`, `cores_per_run` | Run HEC-RAS plans in parallel. |
|
53
|
-
| `compute_parallel_all` | `project_folder`, `ras_exe_path` | Run all HEC-RAS plans in parallel from a project folder path. |
|
54
|
-
|
55
|
-
[The rest of the function list remains the same, just ensure the class names are updated to their new lowercase versions]
|
56
|
-
|
57
|
-
## Potential Uses of RAS-Commander Functions
|
58
|
-
|
59
|
-
[This section remains unchanged]
|
60
|
-
|
61
|
-
## GitHub Actions
|
62
|
-
|
63
|
-
[This section remains unchanged]
|
64
|
-
|
65
|
-
## Basic Usage Instructions
|
66
|
-
|
67
|
-
To get started with RAS-Commander, follow these steps:
|
68
|
-
|
69
|
-
1. Install the library:
|
70
|
-
```
|
71
|
-
pip install ras-commander
|
72
|
-
```
|
73
|
-
|
74
|
-
2. Import the necessary modules:
|
75
|
-
```python
|
76
|
-
from ras_commander import rasinit, RasFileOps, RasPrj, RasPlan, RasGeo, RasUnsteady, RasCommander, RasUtils
|
77
|
-
```
|
78
|
-
|
79
|
-
3. Initialize a HEC-RAS project:
|
80
|
-
```python
|
81
|
-
project_folder = r"C:\path\to\your\project"
|
82
|
-
ras_exe_path = r"C:\Program Files (x86)\HEC\HEC-RAS\6.5\Ras.exe"
|
83
|
-
config = rasinit(project_folder, ras_exe_path)
|
84
|
-
```
|
85
|
-
|
86
|
-
4. Perform operations on your HEC-RAS project. For example:
|
87
|
-
|
88
|
-
- Execute a single plan:
|
89
|
-
```python
|
90
|
-
plan_file = RasPlan.get_plan_path("01")
|
91
|
-
RasCommander.compute_plan(plan_file)
|
92
|
-
```
|
93
|
-
|
94
|
-
- Run multiple plans in parallel:
|
95
|
-
```python
|
96
|
-
max_workers = 2
|
97
|
-
cores_per_run = 1
|
98
|
-
results = RasCommander.compute_parallel(config, max_workers, cores_per_run)
|
99
|
-
```
|
100
|
-
|
101
|
-
- Copy and modify geometry files:
|
102
|
-
```python
|
103
|
-
RasGeo.clone_geom(config.project_folder, "01")
|
104
|
-
plan_file = RasPlan.get_plan_path("01")
|
105
|
-
RasGeo.set_geom(plan_file, "02")
|
106
|
-
```
|
107
|
-
|
108
|
-
- Work with unsteady flow files:
|
109
|
-
```python
|
110
|
-
new_unsteady_number = RasUnsteady.clone_unsteady(config.project_folder, "01")
|
111
|
-
plan_file = RasPlan.get_plan_path("01")
|
112
|
-
RasUnsteady.set_unsteady(plan_file, new_unsteady_number)
|
113
|
-
```
|
114
|
-
|
115
|
-
5. Access project information:
|
116
|
-
```python
|
117
|
-
print(f"Project name: {config.project_name}")
|
118
|
-
print(f"Project file: {config.prj_file}")
|
119
|
-
print(f"Project folder: {config.project_folder}")
|
120
|
-
```
|
121
|
-
|
122
|
-
For more detailed examples and advanced usage, refer to the function documentation and the examples provided in the repository.
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
NOTES: INCORPORATE INTO THE README.MD FILE ABOVE UNDER A NEW SECTION FOR CURRENT USES AND ROADMAP ITEMS, THEN DELETE THIS NOTE
|
128
|
-
|
129
|
-
|
130
|
-
Potential Uses of HEC-RAS Automation Functions
|
131
|
-
This set of functions provides a powerful foundation for automating various aspects of HEC-RAS modeling workflows. Here are some potential applications:
|
132
|
-
1. Calibration and Sensitivity Analysis:
|
133
|
-
Automated Parameter Variation: Users can create multiple simulation scenarios with varying parameters (e.g., Manning's n values, boundary conditions, initial conditions) to calibrate their model against observed data.
|
134
|
-
Sensitivity Testing: Evaluate the impact of different input parameters on model outputs by generating a range of scenarios and analyzing the results. This helps identify critical parameters that require more attention during calibration.
|
135
|
-
2. Real-time Forecasting:
|
136
|
-
Dynamic Model Updates: Integrate with external data sources (e.g., weather forecasts, streamflow observations) to automatically update boundary conditions and initial conditions in unsteady flow files before running the simulation.
|
137
|
-
Ensemble Forecasting: Generate multiple forecasts by incorporating uncertainty in input data and model parameters. This provides a more comprehensive understanding of potential future flow conditions.
|
138
|
-
3. Scenario Analysis:
|
139
|
-
Land Use Change Impacts: Evaluate the effects of land use changes on flood risk by modifying Manning's n values using extract_2d_mannings_tables, modify_2d_mannings_table, and write_2d_mannings_tables and running simulations with updated geometry files.
|
140
|
-
Climate Change Impacts: Analyze the potential impacts of projected climate changes on flood risk by adjusting precipitation patterns and other relevant parameters in unsteady flow files.
|
141
|
-
4. Batch Processing and High-Performance Computing:
|
142
|
-
Large-scale Model Runs: Utilize run_plans_parallel to execute multiple simulations concurrently on a multi-core system, significantly reducing processing time for large-scale models or complex scenarios.
|
143
|
-
Automated Report Generation: Integrate with Python libraries like matplotlib and bokeh to automatically generate customized reports summarizing simulation results, including tables, figures, and maps.
|
144
|
-
5. Model Development and Testing:
|
145
|
-
Rapid Prototyping: Quickly set up and run new model configurations using template files and automated workflows, facilitating rapid model development and testing.
|
146
|
-
Regression Testing: Ensure model integrity and consistency after code changes or updates by automatically running a predefined set of simulations and comparing results with expected outputs.
|
147
|
-
6. User-Friendly Interfaces:
|
148
|
-
GUI Development: Integrate with Python GUI libraries like Tkinter or PyQt to create user-friendly interfaces for automating HEC-RAS workflows, allowing non-programmers to access the power of automation.
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
Certainly! I'll create an updated README.md for the ras_commander library, incorporating the information you've provided and the context from the previous HEC-Commander tools. Here's the updated README.md:
|
156
|
-
|
157
|
-
```markdown
|
158
|
-
# ras_commander
|
1
|
+
# RAS-Commander (ras_commander)
|
159
2
|
|
160
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 RAS-Commander 1.0 Python Notebook Application previously released under the HEC-Commander tools.
|
161
4
|
|
@@ -173,13 +16,13 @@ ras_commander is a Python library for automating HEC-RAS operations, providing a
|
|
173
16
|
Install ras_commander using pip:
|
174
17
|
|
175
18
|
```bash
|
176
|
-
pip install
|
19
|
+
pip install ras-commander
|
177
20
|
```
|
178
21
|
|
179
22
|
## Requirements
|
180
23
|
|
181
24
|
- Python 3.9+
|
182
|
-
- HEC-RAS 6.
|
25
|
+
- HEC-RAS 6.2 or later (other versions may work, all testing was done with version 6.2 and above)
|
183
26
|
|
184
27
|
For a full list of dependencies, see the `requirements.txt` file.
|
185
28
|
|
@@ -284,9 +127,10 @@ ras_commander
|
|
284
127
|
├── setup.cfg
|
285
128
|
├── setup.py
|
286
129
|
└── requirements.txt
|
130
|
+
```
|
287
131
|
|
288
132
|
|
289
|
-
## Inclusion of .cursorrules for AI-driven Coding Experience
|
133
|
+
## Inclusion of .cursorrules and ai_tools for AI-driven Coding Experience
|
290
134
|
|
291
135
|
Open the ras_commander folder in the Cursor IDE, and it will automatically include the .cursorrules file in your instructions. Additionally, two other provided methods for interacting with the library though your current AI subscriptions:
|
292
136
|
|
@@ -295,6 +139,7 @@ Open the ras_commander folder in the Cursor IDE, and it will automatically inclu
|
|
295
139
|
- Entire code base: LINK HERE (TOKEN COUNT) (for Claude or Gemini)
|
296
140
|
- Examples and Function Docstrings Only: LINK HERE (TOKEN COUNT) (for GPT-4o, o1 or Llama 3.1 405b)
|
297
141
|
- Cursor IDE through .cursorrules file
|
142
|
+
- 'rascommander_code_assistant.ipynb' notebook in the ras_commander folder, which allows for dynamic summarization of the code base and API chatting directly through the notebook.
|
298
143
|
|
299
144
|
There are a series of scripts provided in the "llm_summaries" folder that provide summaries of the code base, and the docstrings of the functions. They can be run in your local environment, or provided to ChatGPT's code interpreter for execution.
|
300
145
|
|
@@ -311,8 +156,6 @@ We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) f
|
|
311
156
|
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.
|
312
157
|
|
313
158
|
|
314
|
-
|
315
|
-
|
316
159
|
## License
|
317
160
|
|
318
161
|
ras_commander is released under the MIT License. See the license file for details.
|
@@ -327,3 +170,36 @@ ras_commander is based on the HEC-Commander project's "Command Line is All You N
|
|
327
170
|
|
328
171
|
For questions, suggestions, or support, please contact:
|
329
172
|
William Katzenmeyer, P.E., C.F.M. - billk@fenstermaker.com
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
NOTES: INCORPORATE INTO THE README.MD FILE ABOVE UNDER A NEW SECTION FOR CURRENT USES AND ROADMAP ITEMS, THEN DELETE THIS NOTE
|
183
|
+
|
184
|
+
|
185
|
+
Potential Uses of HEC-RAS Automation Functions
|
186
|
+
This set of functions provides a powerful foundation for automating various aspects of HEC-RAS modeling workflows. Here are some potential applications:
|
187
|
+
1. Calibration and Sensitivity Analysis:
|
188
|
+
Automated Parameter Variation: Users can create multiple simulation scenarios with varying parameters (e.g., Manning's n values, boundary conditions, initial conditions) to calibrate their model against observed data.
|
189
|
+
Sensitivity Testing: Evaluate the impact of different input parameters on model outputs by generating a range of scenarios and analyzing the results. This helps identify critical parameters that require more attention during calibration.
|
190
|
+
2. Real-time Forecasting:
|
191
|
+
Dynamic Model Updates: Integrate with external data sources (e.g., weather forecasts, streamflow observations) to automatically update boundary conditions and initial conditions in unsteady flow files before running the simulation.
|
192
|
+
Ensemble Forecasting: Generate multiple forecasts by incorporating uncertainty in input data and model parameters. This provides a more comprehensive understanding of potential future flow conditions.
|
193
|
+
3. Scenario Analysis:
|
194
|
+
Land Use Change Impacts: Evaluate the effects of land use changes on flood risk by modifying Manning's n values using extract_2d_mannings_tables, modify_2d_mannings_table, and write_2d_mannings_tables and running simulations with updated geometry files.
|
195
|
+
Climate Change Impacts: Analyze the potential impacts of projected climate changes on flood risk by adjusting precipitation patterns and other relevant parameters in unsteady flow files.
|
196
|
+
4. Batch Processing and High-Performance Computing:
|
197
|
+
Large-scale Model Runs: Utilize run_plans_parallel to execute multiple simulations concurrently on a multi-core system, significantly reducing processing time for large-scale models or complex scenarios.
|
198
|
+
Automated Report Generation: Integrate with Python libraries like matplotlib and bokeh to automatically generate customized reports summarizing simulation results, including tables, figures, and maps.
|
199
|
+
5. Model Development and Testing:
|
200
|
+
Rapid Prototyping: Quickly set up and run new model configurations using template files and automated workflows, facilitating rapid model development and testing.
|
201
|
+
Regression Testing: Ensure model integrity and consistency after code changes or updates by automatically running a predefined set of simulations and comparing results with expected outputs.
|
202
|
+
6. User-Friendly Interfaces:
|
203
|
+
GUI Development: Integrate with Python GUI libraries like Tkinter or PyQt to create user-friendly interfaces for automating HEC-RAS workflows, allowing non-programmers to access the power of automation.
|
204
|
+
|
205
|
+
|
@@ -0,0 +1,66 @@
|
|
1
|
+
from pathlib import Path
|
2
|
+
|
3
|
+
# Get the name of this script
|
4
|
+
this_script = Path(__file__).name
|
5
|
+
print(f"Script name: {this_script}")
|
6
|
+
|
7
|
+
# Define the subfolder to summarize
|
8
|
+
summarize_subfolder = Path(__file__).parent.parent
|
9
|
+
print(f"Subfolder to summarize: {summarize_subfolder}")
|
10
|
+
|
11
|
+
# Define the output file name based on the folder name
|
12
|
+
output_file_name = f"{summarize_subfolder.name}.txt"
|
13
|
+
output_file_path = Path(__file__).parent / "llm_summary" / output_file_name
|
14
|
+
print(f"Output file path: {output_file_path}")
|
15
|
+
|
16
|
+
# Ensure the output directory exists
|
17
|
+
output_file_path.parent.mkdir(parents=True, exist_ok=True)
|
18
|
+
print(f"Output directory ensured to exist: {output_file_path.parent}")
|
19
|
+
|
20
|
+
# Define folders to omit
|
21
|
+
omit_folders = ["Bald Eagle Creek", "__pycache__", ".git", ".github", "tests", "build", "dist", "ras_commander.egg-info", "venv", "example_projects", "llm_summary", "misc",]
|
22
|
+
print(f"Folders to omit: {omit_folders}")
|
23
|
+
|
24
|
+
# Define files or extensions to omit
|
25
|
+
omit_files = [".pyc", ".pyo", ".pyd", ".dll", ".so", ".dylib", ".exe", ".bat", ".sh", ".log", ".tmp", ".bak", ".swp", ".DS_Store", "Thumbs.db", "example_projects.zip", "Example_Projects_6_5.zip", "example_projects.ipynb",]
|
26
|
+
print(f"Files or extensions to omit: {omit_files}")
|
27
|
+
|
28
|
+
# Open the output file
|
29
|
+
with open(output_file_path, 'w', encoding='utf-8') as outfile:
|
30
|
+
print(f"Opened output file: {output_file_path}")
|
31
|
+
# Iterate over all files and subfolders in the summarize_subfolder directory
|
32
|
+
for filepath in summarize_subfolder.rglob('*'):
|
33
|
+
# Check if the file is not this script, not in the omit_folders, and not in omit_files
|
34
|
+
if (filepath.name != this_script and
|
35
|
+
not any(omit_folder in filepath.parts for omit_folder in omit_folders) and
|
36
|
+
not any(filepath.suffix == ext or filepath.name == ext for ext in omit_files)):
|
37
|
+
# Write the filename or folder name
|
38
|
+
if filepath.is_file():
|
39
|
+
outfile.write(f"File: {filepath}\n")
|
40
|
+
print(f"Writing file: {filepath}")
|
41
|
+
else:
|
42
|
+
outfile.write(f"Folder: {filepath}\n")
|
43
|
+
print(f"Writing folder: {filepath}")
|
44
|
+
outfile.write("="*50 + "\n") # Separator
|
45
|
+
|
46
|
+
# If it's a file, open and read the contents of the file
|
47
|
+
if filepath.is_file():
|
48
|
+
try:
|
49
|
+
with open(filepath, 'r', encoding='utf-8') as infile:
|
50
|
+
content = infile.read()
|
51
|
+
print(f"Reading content of file: {filepath}")
|
52
|
+
except UnicodeDecodeError:
|
53
|
+
with open(filepath, 'rb') as infile:
|
54
|
+
content = infile.read()
|
55
|
+
content = content.decode('utf-8', errors='ignore')
|
56
|
+
print(f"Reading and converting content of file: {filepath}")
|
57
|
+
|
58
|
+
# Write the contents to the output file
|
59
|
+
outfile.write(content)
|
60
|
+
print(f"Written content of file: {filepath}")
|
61
|
+
|
62
|
+
# Write a separator after the file contents or folder name
|
63
|
+
outfile.write("\n" + "="*50 + "\n\n")
|
64
|
+
print(f"Written separator for: {filepath}")
|
65
|
+
|
66
|
+
print(f"All files and folders have been combined into '{output_file_path}'")
|
@@ -0,0 +1,66 @@
|
|
1
|
+
from pathlib import Path
|
2
|
+
|
3
|
+
# Get the name of this script
|
4
|
+
this_script = Path(__file__).name
|
5
|
+
print(f"Script name: {this_script}")
|
6
|
+
|
7
|
+
# Define the subfolder to summarize
|
8
|
+
summarize_subfolder = Path(__file__).parent.parent
|
9
|
+
print(f"Subfolder to summarize: {summarize_subfolder}")
|
10
|
+
|
11
|
+
# Define the output file name based on the folder name
|
12
|
+
output_file_name = f"{summarize_subfolder.name}_code_only.txt"
|
13
|
+
output_file_path = Path(__file__).parent / "llm_summary" / output_file_name
|
14
|
+
print(f"Output file path: {output_file_path}")
|
15
|
+
|
16
|
+
# Ensure the output directory exists
|
17
|
+
output_file_path.parent.mkdir(parents=True, exist_ok=True)
|
18
|
+
print(f"Output directory ensured to exist: {output_file_path.parent}")
|
19
|
+
|
20
|
+
# Define folders to omit
|
21
|
+
omit_folders = ["Bald Eagle Creek", "__pycache__", ".git", ".github", "tests", "build", "dist", "ras_commander.egg-info", "venv", "example_projects", "llm_summary", "misc", "future", ".github"]
|
22
|
+
print(f"Folders to omit: {omit_folders}")
|
23
|
+
|
24
|
+
# Define files or extensions to omit
|
25
|
+
omit_files = [".pyc", ".pyo", ".pyd", ".dll", ".so", ".dylib", ".exe", ".bat", ".sh", ".log", ".tmp", ".bak", ".swp", ".DS_Store", "Thumbs.db", "example_projects.zip", "11_accessing_example_projects.ipynb", "Example_Projects_6_5.zip"]
|
26
|
+
print(f"Files or extensions to omit: {omit_files}")
|
27
|
+
|
28
|
+
# Open the output file
|
29
|
+
with open(output_file_path, 'w', encoding='utf-8') as outfile:
|
30
|
+
print(f"Opened output file: {output_file_path}")
|
31
|
+
# Iterate over all files and subfolders in the summarize_subfolder directory
|
32
|
+
for filepath in summarize_subfolder.rglob('*'):
|
33
|
+
# Check if the file is not this script, not in the omit_folders, and not in omit_files
|
34
|
+
if (filepath.name != this_script and
|
35
|
+
not any(omit_folder in filepath.parts for omit_folder in omit_folders) and
|
36
|
+
not any(filepath.suffix == ext or filepath.name == ext for ext in omit_files)):
|
37
|
+
# Write the filename or folder name
|
38
|
+
if filepath.is_file():
|
39
|
+
outfile.write(f"File: {filepath}\n")
|
40
|
+
print(f"Writing file: {filepath}")
|
41
|
+
else:
|
42
|
+
outfile.write(f"Folder: {filepath}\n")
|
43
|
+
print(f"Writing folder: {filepath}")
|
44
|
+
outfile.write("="*50 + "\n") # Separator
|
45
|
+
|
46
|
+
# If it's a file, open and read the contents of the file
|
47
|
+
if filepath.is_file():
|
48
|
+
try:
|
49
|
+
with open(filepath, 'r', encoding='utf-8') as infile:
|
50
|
+
content = infile.read()
|
51
|
+
print(f"Reading content of file: {filepath}")
|
52
|
+
except UnicodeDecodeError:
|
53
|
+
with open(filepath, 'rb') as infile:
|
54
|
+
content = infile.read()
|
55
|
+
content = content.decode('utf-8', errors='ignore')
|
56
|
+
print(f"Reading and converting content of file: {filepath}")
|
57
|
+
|
58
|
+
# Write the contents to the output file
|
59
|
+
outfile.write(content)
|
60
|
+
print(f"Written content of file: {filepath}")
|
61
|
+
|
62
|
+
# Write a separator after the file contents or folder name
|
63
|
+
outfile.write("\n" + "="*50 + "\n\n")
|
64
|
+
print(f"Written separator for: {filepath}")
|
65
|
+
|
66
|
+
print(f"All files and folders have been combined into '{output_file_path}'")
|