hms-commander 0.1.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 (106) hide show
  1. hms_commander-0.1.0/.readthedocs.yaml +24 -0
  2. hms_commander-0.1.0/CLAUDE.md +280 -0
  3. hms_commander-0.1.0/CLAUDE.md.backup +533 -0
  4. hms_commander-0.1.0/GETTING_STARTED.md +298 -0
  5. hms_commander-0.1.0/LICENSE +21 -0
  6. hms_commander-0.1.0/MANIFEST.in +44 -0
  7. hms_commander-0.1.0/PKG-INFO +231 -0
  8. hms_commander-0.1.0/QUICK_REFERENCE.md +574 -0
  9. hms_commander-0.1.0/README.md +180 -0
  10. hms_commander-0.1.0/STYLE_GUIDE.md +762 -0
  11. hms_commander-0.1.0/docs/CLB_ENGINEERING_APPROACH.md +393 -0
  12. hms_commander-0.1.0/docs/DOCUMENTATION_INDEX.md +176 -0
  13. hms_commander-0.1.0/docs/README.md +264 -0
  14. hms_commander-0.1.0/docs/api/_constants.md +17 -0
  15. hms_commander-0.1.0/docs/api/_parsing.md +11 -0
  16. hms_commander-0.1.0/docs/api/hms_basin.md +11 -0
  17. hms_commander-0.1.0/docs/api/hms_cmdr.md +11 -0
  18. hms_commander-0.1.0/docs/api/hms_control.md +11 -0
  19. hms_commander-0.1.0/docs/api/hms_dss.md +11 -0
  20. hms_commander-0.1.0/docs/api/hms_examples.md +11 -0
  21. hms_commander-0.1.0/docs/api/hms_gage.md +11 -0
  22. hms_commander-0.1.0/docs/api/hms_geo.md +11 -0
  23. hms_commander-0.1.0/docs/api/hms_jython.md +11 -0
  24. hms_commander-0.1.0/docs/api/hms_met.md +11 -0
  25. hms_commander-0.1.0/docs/api/hms_prj.md +11 -0
  26. hms_commander-0.1.0/docs/api/hms_results.md +11 -0
  27. hms_commander-0.1.0/docs/api/hms_run.md +11 -0
  28. hms_commander-0.1.0/docs/api/hms_utils.md +11 -0
  29. hms_commander-0.1.0/docs/assets/hms-commander_logo.svg +57 -0
  30. hms_commander-0.1.0/docs/data_formats/basin_file.md +560 -0
  31. hms_commander-0.1.0/docs/data_formats/control_file.md +408 -0
  32. hms_commander-0.1.0/docs/data_formats/dss_integration.md +587 -0
  33. hms_commander-0.1.0/docs/data_formats/gage_file.md +454 -0
  34. hms_commander-0.1.0/docs/data_formats/geo_files.md +557 -0
  35. hms_commander-0.1.0/docs/data_formats/met_file.md +494 -0
  36. hms_commander-0.1.0/docs/data_formats/overview.md +200 -0
  37. hms_commander-0.1.0/docs/data_formats/project_file.md +358 -0
  38. hms_commander-0.1.0/docs/data_formats/run_file.md +499 -0
  39. hms_commander-0.1.0/docs/examples/overview.md +212 -0
  40. hms_commander-0.1.0/docs/getting_started/installation.md +142 -0
  41. hms_commander-0.1.0/docs/getting_started/project_initialization.md +291 -0
  42. hms_commander-0.1.0/docs/getting_started/quick_start.md +229 -0
  43. hms_commander-0.1.0/docs/index.md +151 -0
  44. hms_commander-0.1.0/docs/llm_dev/architecture.md +359 -0
  45. hms_commander-0.1.0/docs/llm_dev/claude_md.md +287 -0
  46. hms_commander-0.1.0/docs/llm_dev/contributing.md +318 -0
  47. hms_commander-0.1.0/docs/llm_dev/overview.md +174 -0
  48. hms_commander-0.1.0/docs/llm_dev/release_notes.md +220 -0
  49. hms_commander-0.1.0/docs/llm_dev/style_guide.md +61 -0
  50. hms_commander-0.1.0/docs/stylesheets/extra.css +71 -0
  51. hms_commander-0.1.0/docs/user_guide/atlas14_updates.md +204 -0
  52. hms_commander-0.1.0/docs/user_guide/basin_models.md +65 -0
  53. hms_commander-0.1.0/docs/user_guide/clone_workflows.md +217 -0
  54. hms_commander-0.1.0/docs/user_guide/control_specs.md +79 -0
  55. hms_commander-0.1.0/docs/user_guide/dss_operations.md +133 -0
  56. hms_commander-0.1.0/docs/user_guide/execution.md +122 -0
  57. hms_commander-0.1.0/docs/user_guide/gages.md +84 -0
  58. hms_commander-0.1.0/docs/user_guide/geospatial.md +115 -0
  59. hms_commander-0.1.0/docs/user_guide/meteorologic_models.md +71 -0
  60. hms_commander-0.1.0/docs/user_guide/overview.md +71 -0
  61. hms_commander-0.1.0/docs/user_guide/project_management.md +45 -0
  62. hms_commander-0.1.0/docs/user_guide/results_analysis.md +144 -0
  63. hms_commander-0.1.0/docs/user_guide/run_configuration.md +95 -0
  64. hms_commander-0.1.0/examples/01_multi_version_execution.ipynb +1142 -0
  65. hms_commander-0.1.0/examples/02_run_all_hms413_projects.ipynb +755 -0
  66. hms_commander-0.1.0/examples/03_project_dataframes.ipynb +480 -0
  67. hms_commander-0.1.0/examples/04_hms_workflow.ipynb +591 -0
  68. hms_commander-0.1.0/examples/HMS_413_Example_Projects_Documentation.md +608 -0
  69. hms_commander-0.1.0/examples/clone_workflow.ipynb +438 -0
  70. hms_commander-0.1.0/examples/extract_example.py +252 -0
  71. hms_commander-0.1.0/examples/test_hmsprj_dataframes.py +171 -0
  72. hms_commander-0.1.0/hms-commander_logo.svg +57 -0
  73. hms_commander-0.1.0/hms_commander/Decorators.py +150 -0
  74. hms_commander-0.1.0/hms_commander/HmsBasin.py +637 -0
  75. hms_commander-0.1.0/hms_commander/HmsCmdr.py +512 -0
  76. hms_commander-0.1.0/hms_commander/HmsControl.py +405 -0
  77. hms_commander-0.1.0/hms_commander/HmsDss.py +628 -0
  78. hms_commander-0.1.0/hms_commander/HmsExamples.py +710 -0
  79. hms_commander-0.1.0/hms_commander/HmsGage.py +404 -0
  80. hms_commander-0.1.0/hms_commander/HmsGeo.py +757 -0
  81. hms_commander-0.1.0/hms_commander/HmsJython.py +1210 -0
  82. hms_commander-0.1.0/hms_commander/HmsMet.py +699 -0
  83. hms_commander-0.1.0/hms_commander/HmsOutput.py +710 -0
  84. hms_commander-0.1.0/hms_commander/HmsPrj.py +1332 -0
  85. hms_commander-0.1.0/hms_commander/HmsResults.py +521 -0
  86. hms_commander-0.1.0/hms_commander/HmsRun.py +1494 -0
  87. hms_commander-0.1.0/hms_commander/HmsUtils.py +667 -0
  88. hms_commander-0.1.0/hms_commander/LoggingConfig.py +91 -0
  89. hms_commander-0.1.0/hms_commander/__init__.py +143 -0
  90. hms_commander-0.1.0/hms_commander/_constants.py +283 -0
  91. hms_commander-0.1.0/hms_commander/_parsing.py +287 -0
  92. hms_commander-0.1.0/hms_commander/dss/__init__.py +38 -0
  93. hms_commander-0.1.0/hms_commander/dss/_hec_monolith.py +362 -0
  94. hms_commander-0.1.0/hms_commander/dss/core.py +563 -0
  95. hms_commander-0.1.0/hms_commander.egg-info/PKG-INFO +231 -0
  96. hms_commander-0.1.0/hms_commander.egg-info/SOURCES.txt +104 -0
  97. hms_commander-0.1.0/hms_commander.egg-info/dependency_links.txt +1 -0
  98. hms_commander-0.1.0/hms_commander.egg-info/requires.txt +30 -0
  99. hms_commander-0.1.0/hms_commander.egg-info/top_level.txt +1 -0
  100. hms_commander-0.1.0/mkdocs.yml +167 -0
  101. hms_commander-0.1.0/pyproject.toml +94 -0
  102. hms_commander-0.1.0/setup.cfg +4 -0
  103. hms_commander-0.1.0/tests/test_atlas14_integration.py +553 -0
  104. hms_commander-0.1.0/tests/test_direct_java_execution.py +233 -0
  105. hms_commander-0.1.0/tests/test_extraction.py +271 -0
  106. hms_commander-0.1.0/tests/test_output.txt +110 -0
@@ -0,0 +1,24 @@
1
+ # Read the Docs configuration file
2
+ # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
3
+
4
+ version: 2
5
+
6
+ build:
7
+ os: ubuntu-22.04
8
+ tools:
9
+ python: "3.11"
10
+ jobs:
11
+ post_install:
12
+ # Install mkdocs dependencies
13
+ - pip install -e ".[docs]"
14
+
15
+ mkdocs:
16
+ configuration: mkdocs.yml
17
+ fail_on_warning: false
18
+
19
+ python:
20
+ install:
21
+ - method: pip
22
+ path: .
23
+ extra_requirements:
24
+ - docs
@@ -0,0 +1,280 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code when working with hms-commander.
4
+
5
+ ---
6
+
7
+ ## Project Overview
8
+
9
+ **hms-commander** is a Python library for automating HEC-HMS (Hydrologic Engineering Center's Hydrologic Modeling System) operations. It provides a comprehensive API for interacting with HEC-HMS project files, executing simulations, and processing results, following the architectural patterns established by ras-commander.
10
+
11
+ ---
12
+
13
+ ## Development Environment
14
+
15
+ ### Package Management
16
+ - **Agent scripts and tools**: Use `uv` for installation, `python` for execution
17
+ - **User-facing docs**: Use `pip` for broader compatibility
18
+ - **Fast installation**: `uv pip install -e ".[all]"` (10-100x faster than pip)
19
+
20
+ ### Build Commands
21
+ - **Install locally**: `pip install -e .` (for development)
22
+ - **Install from build**: `pip install hms-commander`
23
+ - **Install with optional dependencies**: `pip install -e ".[all]"` (includes dev, gis, dss)
24
+
25
+ ### Dependencies
26
+ - **Python**: Requires 3.10+
27
+ - **Core packages**: pandas, numpy, pathlib, tqdm, requests
28
+ - **Optional GIS**: geopandas, pyproj, shapely
29
+ - **Optional DSS**: ras-commander, pyjnius
30
+
31
+ ### Testing Environments (Conda)
32
+ - **hmscmdr_local**: Local development version (use when making code changes)
33
+ - `conda create -n hmscmdr_local python=3.11`
34
+ - `conda activate hmscmdr_local && pip install -e ".[all]"`
35
+ - Editable install, changes immediately reflected in notebooks
36
+
37
+ - **hmscmdr_pip**: Published package version (use for release validation)
38
+ - `conda create -n hmscmdr_pip python=3.11`
39
+ - `conda activate hmscmdr_pip && pip install hms-commander`
40
+ - Matches end-user experience
41
+
42
+ **See**: `.claude/rules/project/development-environment.md` for complete testing protocols
43
+
44
+ ---
45
+
46
+ ## Architecture Overview
47
+
48
+ ### Core Classes
49
+
50
+ **File Operations**: HmsBasin, HmsMet, HmsControl, HmsGage, HmsRun, HmsGeo
51
+ **Execution**: HmsCmdr, HmsJython
52
+ **Data**: HmsDss, HmsResults
53
+ **Utilities**: HmsUtils, HmsExamples
54
+ **Project**: HmsPrj (initialization and multi-project support)
55
+
56
+ ### Key Architectural Patterns
57
+
58
+ **Static Classes**: All core classes use static methods, no instantiation required.
59
+ See: `.claude/rules/python/static-classes.md`
60
+
61
+ **File Parsing**: Shared HmsFileParser eliminates duplication.
62
+ See: `.claude/rules/python/file-parsing.md`
63
+
64
+ **Clone Workflows**: Non-destructive, traceable, GUI-verifiable (CLB Engineering approach).
65
+ See: `.claude/rules/hec-hms/clone-workflows.md`
66
+
67
+ ---
68
+
69
+ ## Quick Start
70
+
71
+ ### Initialize and Execute
72
+
73
+ ```python
74
+ from hms_commander import init_hms_project, HmsCmdr
75
+
76
+ init_hms_project(r"C:\Projects\watershed")
77
+ HmsCmdr.compute_run("Run 1")
78
+ ```
79
+
80
+ ### Access Project Data
81
+
82
+ ```python
83
+ from hms_commander import hms
84
+
85
+ # After initialization, access dataframes
86
+ subbasins = hms.basin_df
87
+ met_models = hms.met_df
88
+ runs = hms.run_df
89
+ ```
90
+
91
+ ### Direct File Operations (No Initialization)
92
+
93
+ ```python
94
+ from hms_commander import HmsBasin, HmsMet
95
+
96
+ subbasins = HmsBasin.get_subbasins("project.basin")
97
+ HmsMet.set_gage_assignment("project.met", "Sub1", "Gage1")
98
+ ```
99
+
100
+ ---
101
+
102
+ ## Detailed Documentation
103
+
104
+ ### For Complete API
105
+
106
+ **Code**: `hms_commander/*.py` - All classes have comprehensive docstrings
107
+ **Examples**: `examples/*.ipynb` - Working demonstrations
108
+ **API Docs**: `docs/api/*.md` - Generated reference
109
+ **File Formats**: `tests/projects/2014.08_HMS/File Parsing Guide/` - HMS file structures
110
+
111
+ ### For Patterns and Workflows
112
+
113
+ **See**: `.claude/rules/` for organized knowledge:
114
+
115
+ **Python Patterns** (`.claude/rules/python/`):
116
+ - static-classes.md - Core HMS pattern
117
+ - file-parsing.md - HmsFileParser utilities
118
+ - constants.md - Centralized magic numbers
119
+ - decorators.md, path-handling.md, error-handling.md, naming-conventions.md
120
+
121
+ **HMS Domain Knowledge** (`.claude/rules/hec-hms/`):
122
+ - execution.md - HmsCmdr, HmsJython, version detection
123
+ - basin-files.md - HmsBasin operations
124
+ - met-files.md - HmsMet operations
125
+ - control-files.md - HmsControl operations
126
+ - dss-operations.md - HmsDss, HmsResults
127
+ - clone-workflows.md - CLB Engineering LLM Forward approach
128
+ - version-support.md - HMS 3.x vs 4.x differences
129
+
130
+ **Testing** (`.claude/rules/testing/`):
131
+ - example-projects.md - HmsExamples usage
132
+ - tdd-approach.md - No mocks, use real HMS projects
133
+
134
+ ---
135
+
136
+ ## Key Principles
137
+
138
+ ### 1. Static Classes, No Instantiation
139
+
140
+ ```python
141
+ # ✅ Correct
142
+ HmsBasin.get_subbasins("project.basin")
143
+
144
+ # ❌ Wrong
145
+ basin = HmsBasin() # Don't do this
146
+ ```
147
+
148
+ ### 2. Test with Real Projects, Not Mocks
149
+
150
+ ```python
151
+ from hms_commander import HmsExamples, HmsBasin
152
+
153
+ HmsExamples.extract_project("tifton") # Real HMS project
154
+ subbasins = HmsBasin.get_subbasins("tifton/tifton.basin")
155
+ ```
156
+
157
+ ### 3. HMS Version Awareness
158
+
159
+ **HMS 3.x (32-bit)**: Requires `python2_compatible=True`
160
+ **HMS 4.x (64-bit)**: Default Python 3 syntax
161
+
162
+ See: `.claude/rules/hec-hms/version-support.md`
163
+
164
+ ### 4. Clone for QAQC
165
+
166
+ Non-destructive workflows enable side-by-side comparison in HEC-HMS GUI.
167
+
168
+ See: `.claude/rules/hec-hms/clone-workflows.md`
169
+
170
+ ---
171
+
172
+ ## Differences from ras-commander
173
+
174
+ | Aspect | ras-commander | hms-commander |
175
+ |--------|---------------|---------------|
176
+ | Primary Files | .prj, .p##, .g##, .hdf | .hms, .basin, .met, .control |
177
+ | Results Format | HDF5 | DSS (via RasDss) |
178
+ | Execution | Subprocess (Ras.exe) | Jython scripts (hec-hms.cmd) |
179
+ | Project Discovery | .prj file | .hms file |
180
+ | Data Storage | HDF groups/datasets | ASCII text sections |
181
+ | Parsing Approach | h5py library | Regex/text parsing |
182
+
183
+ **Integration**: hms-commander uses ras-commander's RasDss for DSS operations (no code duplication).
184
+
185
+ ---
186
+
187
+ ## Cross-Repository Integration: HMS→RAS Workflows
188
+
189
+ **hms-commander** and **ras-commander** work together for integrated watershed-to-river modeling.
190
+
191
+ ### Workflow Pattern
192
+
193
+ ```
194
+ HEC-HMS (Watershed) HEC-RAS (River)
195
+ ↓ ↓
196
+ Precipitation Geometry
197
+ ↓ ↓
198
+ Runoff Generation ←─── Import HMS Flows
199
+ ↓ ↓
200
+ DSS Output Hydraulic Analysis
201
+ ```
202
+
203
+ ### HMS Responsibilities (This Library)
204
+
205
+ 1. **Generate Hydrographs**: Execute simulations, create DSS results
206
+ 2. **Extract Flows**: Use HmsResults to get peak flows and time series
207
+ 3. **Document Spatial Reference**: Use HmsGeo to provide outlet locations
208
+ 4. **Validate Quality**: Check peaks, volumes, time series completeness
209
+
210
+ ```python
211
+ from hms_commander import init_hms_project, HmsCmdr, HmsResults, HmsGeo
212
+
213
+ # Execute HMS
214
+ init_hms_project("watershed")
215
+ HmsCmdr.compute_run("Design_Storm")
216
+
217
+ # Extract for RAS
218
+ flows = HmsResults.get_outflow_timeseries(dss_file, "Outlet")
219
+ lat, lon = HmsGeo.get_project_centroid_latlon("project.geo")
220
+
221
+ # Handoff: DSS file, pathname, outlet location
222
+ ```
223
+
224
+ ### RAS Responsibilities (ras-commander)
225
+
226
+ 1. **Import HMS DSS**: Use RasUnsteady to import boundary conditions
227
+ 2. **Spatial Matching**: Match HMS outlets to RAS cross sections
228
+ 3. **Hydraulic Analysis**: Run unsteady flow with HMS upstream BCs
229
+ 4. **Validation**: Compare HMS peaks vs RAS peaks
230
+
231
+ ### Shared Infrastructure
232
+
233
+ **RasDss**: Both libraries use the same DSS operations
234
+ - HMS: `HmsDss` (wraps RasDss)
235
+ - RAS: `RasDss` (direct)
236
+ - Result: No format conversion, consistent pathnames
237
+
238
+ ### Skills and Subagents
239
+
240
+ - **Skill**: `.claude/skills/linking-hms-to-hecras/` - HMS side workflow
241
+ - **Skill** (ras-commander): `importing-hms-boundaries/` - RAS side workflow
242
+ - **Subagent**: `.claude/subagents/hms-ras-workflow-coordinator.md` - Coordinates both sides
243
+ - **Rules**: `.claude/rules/integration/hms-ras-linking.md` - Integration patterns
244
+
245
+ See these files for complete HMS→RAS integration workflows.
246
+
247
+ ---
248
+
249
+ ## Common Pitfalls to Avoid
250
+
251
+ - ❌ Don't instantiate static classes like `HmsBasin()`
252
+ - ❌ Don't use mocks in tests - use `HmsExamples.extract_project()`
253
+ - ❌ Don't forget `python2_compatible=True` for HMS 3.x
254
+ - ✅ Always specify `hms_object` when working with multiple projects
255
+ - ✅ Use pathlib.Path for all path operations
256
+ - ✅ Handle file encodings (UTF-8 with Latin-1 fallback)
257
+
258
+ ---
259
+
260
+ ## Navigation
261
+
262
+ ### Primary Sources (Authoritative)
263
+ - **Code**: `hms_commander/*.py` (docstrings)
264
+ - **Examples**: `examples/*.ipynb` (workflows)
265
+ - **File Formats**: `tests/projects/.../File Parsing Guide/`
266
+ - **API Docs**: `docs/api/*.md`
267
+
268
+ ### Framework Documentation
269
+ - **Patterns**: `.claude/rules/python/`
270
+ - **HMS Knowledge**: `.claude/rules/hec-hms/`
271
+ - **Testing**: `.claude/rules/testing/`
272
+ - **Documentation**: `.claude/rules/documentation/`
273
+
274
+ ### Task Coordination
275
+ - **Memory**: `.agent/` (multi-session state)
276
+ - **Agents**: `hms_agents/` (production workflows)
277
+ - **Research**: `feature_dev_notes/` (feature development)
278
+
279
+ ### Complete Framework
280
+ See: `.claude/CLAUDE.md` for hierarchical knowledge organization