xiaohongshu
xiaohongshu
managing-hms-versions
Manages HEC-HMS version differences (3.x vs 4.x), handles Python 2/3 compatibility, detects HMS installations, and generates version-appropriate Jython scripts. Use when working with legacy HMS 3.x projects, upgrading models from 3.x to 4.x, testing across multiple HMS versions, or troubleshootin...
Full skill instructions
from hms_commander import HmsJython
# Auto-detect HMS installations
hms_exe = HmsJython.find_hms_executable()
print(f"Found: {hms_exe}")
# Generate version-appropriate script
is_3x = "(x86)" in str(hms_exe) # 32-bit = HMS 3.x
script = HmsJython.generate_compute_script(
project_path="project",
run_name="Run 1",
python2_compatible=is_3x # Critical for 3.x!
)
# Execute with detected version
success, stdout, stderr = HmsJython.execute_script(script, hms_exe)
Code: hms_commander/HmsJython.py - Version detection and script generation
Rules: .claude/rules/hec-hms/version-support.md - Complete differences
Examples: examples/01_multi_version_execution.ipynb - Multi-version workflow
Task Agent: hms_agents/update_3_to_4/ - Automated 3.x → 4.x upgrade
| Version | Support | Architecture | Python | Notes |
|---|---|---|---|---|
| HMS 4.4.1+ | ✅ Full | 64-bit | Python 3 | Recommended |
| HMS 3.3-3.5 | ✅ Full | 32-bit | Python 2 | Requires python2_compatible=True |
| HMS 4.0-4.3 | ❌ | 64-bit | Python 3 | Legacy classpath not supported |
| HMS 3.0-3.2 | ❓ | 32-bit | Python 2 | Untested |
See: .claude/rules/hec-hms/version-support.md for complete table
Install Path: C:\Program Files (x86)\HEC\HEC-HMS\3.x\
Max Memory: ~1.3 GB
Java: java/bin/java.exe
Python: Jython 2.5 (Python 2 syntax)
Script Generation:
script = HmsJython.generate_compute_script(
project_path=path,
run_name=run,
python2_compatible=True # MUST be True for 3.x!
)
Python 2 Syntax:
print "Computing run" # No parentheses
Install Path: C:\Program Files\HEC\HEC-HMS\4.x\
Max Memory: 32+ GB
Java: jre/bin/java.exe
Python: Jython 2.7 (Python 3 syntax)
Script Generation:
script = HmsJython.generate_compute_script(
project_path=path,
run_name=run
# python2_compatible=False (default)
)
Python 3 Syntax:
print(f"Computing {run_name}") # Parentheses required
# Auto-detect from common install locations
hms_exe = HmsJython.find_hms_executable()
# Check if 3.x or 4.x
if "(x86)" in str(hms_exe):
print("HMS 3.x detected (32-bit)")
python2_compatible = True
else:
print("HMS 4.x detected (64-bit)")
python2_compatible = False
script = HmsJython.generate_compute_script(
project_path=project_path,
run_name=run_name,
python2_compatible=python2_compatible
)
HmsJython handles syntax differences automatically.
from hms_commander import HmsExamples
# List installed versions
versions = HmsExamples.list_versions()
print(f"Found HMS versions: {versions}")
# Test across all versions
for version in versions:
HmsExamples.extract_project("tifton", version=version)
# Run tests for this version
See: examples/01_multi_version_execution.ipynb for complete workflow
Automated approach (Recommended):
# Use update_3_to_4 task agent
# See: hms_agents/update_3_to_4/README.md
Manual approach: Open in HMS 4.x GUI, save (converts file format)
# 1. Detect HMS 3.x
hms_3x_path = r"C:\Program Files (x86)\HEC\HEC-HMS\3.5"
# 2. Generate Python 2 script
script = HmsJython.generate_compute_script(
project_path=r"C:\Projects\old_project",
run_name="Run 1",
python2_compatible=True
)
# 3. Execute
success, stdout, stderr = HmsJython.execute_script(
script_content=script,
hms_exe_path=hms_3x_path
)
# 4. Check for Python 2 syntax errors
if "SyntaxError" in stderr:
print("Forgot python2_compatible=True!")
for version in ["3.5", "4.11", "4.13"]:
# Extract version-specific example
HmsExamples.extract_project("tifton", version=version)
# Detect Python 2 vs 3
python2 = version.startswith("3.")
# Generate script
script = HmsJython.generate_compute_script(
f"tifton_{version}/tifton",
"1970_simulation",
python2_compatible=python2
)
# Execute
hms_exe = HmsExamples.get_hms_exe(version)
success, stdout, stderr = HmsJython.execute_script(script, hms_exe)
print(f"HMS {version}: {'✅' if success else '❌'}")
Use the update_3_to_4 task agent:
# See: hms_agents/update_3_to_4/AGENT.md
from hms_agents.update_3_to_4 import VersionUpgrader
upgrader = VersionUpgrader(
project_3x="path/to/hms3x/project",
project_4x="path/to/hms4x/project"
)
verdict = upgrader.execute()
upgrader.export_modeling_log("UPGRADE_LOG.md")
Error: SyntaxError: invalid syntax
Cause: Forgot python2_compatible=True for HMS 3.x
Fix:
script = HmsJython.generate_compute_script(
project_path=path,
run_name=run,
python2_compatible=True # Add this!
)
Error: OutOfMemoryError
Cause: HMS 3.x limited to ~1.3 GB (32-bit)
Fix: Upgrade to HMS 4.x (64-bit) for large models
Error: FileNotFoundError: HMS executable not found
Fix:
# Specify path manually
hms_exe = r"C:\Program Files\HEC\HEC-HMS\4.11\HEC-HMS.cmd"
HmsJython.execute_script(script, hms_exe_path=hms_exe)
reference/hms-3x-vs-4x.md - Complete differences tablereference/python2-compatibility.md - Script syntax differencesexamples/legacy-projects.md - HMS 3.x workflow examplesxiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience