Claude-skill-registry executing-hms-runs
git clone https://github.com/majiayu000/claude-skill-registry
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/executing-hms-runs" ~/.claude/skills/majiayu000-claude-skill-registry-executing-hms-runs && rm -rf "$T"
skills/data/executing-hms-runs/SKILL.mdExecuting HEC-HMS Runs
Quick Start
from hms_commander import init_hms_project, HmsCmdr # Initialize project init_hms_project(r"C:\Projects\watershed") # Execute single run HmsCmdr.compute_run("Run 1") # Execute multiple runs in parallel HmsCmdr.compute_parallel(["Run 1", "Run 2", "Run 3"], max_workers=2)
Primary Sources
Code (Authoritative API):
- Execution engine with complete docstringshms_commander/HmsCmdr.py
- Script generation and version detectionhms_commander/HmsJython.py
Examples (Working Demonstrations):
- Complete workflowexamples/01_multi_version_execution.ipynb
- End-to-end simulationexamples/04_hms_workflow.ipynb
Rules (Patterns & Decisions):
- Execution patterns.claude/rules/hec-hms/execution.md
- HMS 3.x vs 4.x differences.claude/rules/hec-hms/version-support.md
When to Use This Skill
Trigger Scenarios:
- User says "run HMS simulation"
- User says "execute this model"
- User says "compute all runs in parallel"
- User mentions "Jython script"
- Working with HMS 3.x (requires Python 2 compatibility)
- Need to execute batch simulations
- Setting up automated workflows
Core Capabilities
1. Single Run Execution
Pattern: Initialize → Compute → Verify
See
reference/compute_run.md for complete API details.
Key Decision: When to use
compute_run() vs compute_test_mode()
- Use
for actual simulationcompute_run() - Use
to validate setup without runningcompute_test_mode()
2. Parallel Execution
Pattern: Batch runs across multiple workers
See
reference/parallel.md for parallel execution strategies.
Key Decision: How many workers?
- Default: 2 workers (safe for most systems)
- CPU-bound: Use
os.cpu_count() - 1 - Memory-constrained: Use 1 worker (sequential)
- Large models: Consider memory per run × workers
3. Jython Script Generation
Pattern: Generate version-appropriate script → Execute via HMS
See
reference/jython.md for script generation details.
Critical Decision: HMS 3.x vs 4.x
- HMS 3.x: MUST use
python2_compatible=True - HMS 4.x: Use default (Python 3 syntax)
- Auto-detection: Check install path contains "(x86)" = 3.x
HMS Version Awareness
This skill handles BOTH HMS 3.x and 4.x:
| Aspect | HMS 3.x | HMS 4.x |
|---|---|---|
| Architecture | 32-bit | 64-bit |
| Python Syntax | Python 2 () | Python 3 () |
| Script Flag | | Default |
| Max Memory | ~1.3 GB | 32+ GB |
| Install Path | | |
See:
.claude/rules/hec-hms/version-support.md for complete differences
Common Workflows
Workflow 1: Basic Execution
from hms_commander import init_hms_project, HmsCmdr init_hms_project(r"C:\Projects\watershed") HmsCmdr.compute_run("Run 1")
See:
examples/basic-run.md for complete walkthrough
Workflow 2: Batch Execution (Sequential)
runs = ["Baseline", "Alternative_1", "Alternative_2"] HmsCmdr.compute_batch(runs)
See:
examples/batch-runs.md for batch strategies
Workflow 3: Parallel Execution
runs = ["Run_1", "Run_2", "Run_3", "Run_4"] HmsCmdr.compute_parallel(runs, max_workers=2)
See:
reference/parallel.md for worker allocation
Workflow 4: Legacy HMS 3.x Project
from hms_commander import HmsJython # Generate Python 2 compatible script script = HmsJython.generate_compute_script( project_path=r"C:\Projects\old_project", run_name="Run 1", python2_compatible=True # CRITICAL for HMS 3.x! ) # Execute with HMS 3.x success, stdout, stderr = HmsJython.execute_script( script_content=script, hms_exe_path=r"C:\Program Files (x86)\HEC\HEC-HMS\3.5" )
See:
.claude/rules/hec-hms/version-support.md for legacy workflows
Troubleshooting
Common Issues:
- HMS Not Found: See
reference/jython.md#finding-hms - Memory Errors: See
reference/jython.md#memory-allocation - Python 2 Syntax Errors: See
.claude/rules/hec-hms/version-support.md - Parallel Execution Hangs: See
reference/parallel.md#debugging
Integration Points
Before Execution:
- Use
to modify parameters (seeHmsBasin
skill)parsing-basin-models - Use
to update precipitation (seeHmsMet
skill)updating-met-models - Use
to set time window (seeHmsControl
).claude/rules/hec-hms/control-files.md
After Execution:
- Use
to extract results (seeHmsDss
skill)extracting-dss-results - Use
for analysis (seeHmsResults
).claude/rules/hec-hms/dss-operations.md
Reference Files
Detailed API Documentation (load on-demand):
- HmsCmdr.compute_run() complete APIreference/compute_run.md
- Parallel execution strategiesreference/parallel.md
- Script generation and executionreference/jython.md
- Common issues and solutionsreference/troubleshooting.md
Complete Examples (working code):
- Simple single runexamples/basic-run.md
- Sequential batch executionexamples/batch-runs.md
- Parallel execution with worker allocationexamples/parallel-runs.md
- HMS 3.x compatibilityexamples/legacy-3x.md
Testing This Skill
Use real HMS projects for testing:
from hms_commander import HmsExamples # Extract example project HmsExamples.extract_project("tifton") # Test execution init_hms_project("tifton/tifton") HmsCmdr.compute_run("1970_simulation")
See:
.claude/rules/testing/tdd-approach.md for testing philosophy
Key Patterns (Not in Primary Sources)
Pattern 1: Destination Folder Management
HMS creates output in the project folder. For organized results:
# Results go to project_folder/results/RUN_<run_name>.results # DSS file location specified in .run file
Decision: HMS writes to project folder, not a separate destination folder like RAS.
Pattern 2: Version Auto-Detection
from pathlib import Path hms_path = Path(r"C:\Program Files (x86)\HEC\HEC-HMS\3.5") is_3x = "(x86)" in str(hms_path) # 32-bit = HMS 3.x python2_compatible = is_3x
Decision: Use install path pattern for version detection, not HMS version file.
Pattern 3: Error Handling
try: HmsCmdr.compute_run("Run 1") except Exception as e: # Check HMS log file for details log_file = hms.project_folder / f"RUN_Run 1.log" if log_file.exists(): print(log_file.read_text()) raise
Decision: HMS errors appear in log files, check those for diagnostics.
Related Skills
- parsing-basin-models - Modify parameters before execution
- updating-met-models - Update precipitation before execution
- extracting-dss-results - Process outputs after execution
- cloning-hms-components - Create QAQC comparison runs
- managing-hms-versions - Multi-version testing workflows
Navigation: This skill points to primary sources. For complete API details, read the code docstrings in
hms_commander/HmsCmdr.py and hms_commander/HmsJython.py.