Executes HEC-RAS plans using RasCmdr.compute_plan(), handles parallel execution across multiple plans, manages destination folders, and monitors real-time progress with callbacks. Use when running HEC-RAS simulations, computing plans, executing models, parallel workflows, setting up distributed computation, batch processing, scenario analysis, or monitoring execution progress in real-time. Triggers: execute, run, compute, HEC-RAS, plan, simulation, parallel, callback, batch, scenario, destination folder, worker, monitoring, progress, real-time.
When the user asks to run HEC-RAS plans, use RasCmdr.compute_plan() for single plans or RasCmdr.compute_parallel() for multiple. Read the primary sources below for complete parameter details.
Location: ras_commander/AGENTS.md
Read these sections:
Key execution modes:
# Single plan
RasCmdr.compute_plan("01", dest_folder="run1", num_cores=4)
# Parallel local
RasCmdr.compute_parallel(["01", "02", "03"], max_workers=3)
# Sequential test
RasCmdr.compute_test_mode(["01", "02"])
Core execution notebooks:
examples/110_single_plan_execution.ipynb - Complete single plan workflowexamples/111_executing_plan_sets.ipynb - Plan sets and batch processingexamples/112_sequential_plan_execution.ipynb - Test mode executionexamples/113_parallel_execution.ipynb - Parallel execution with performance analysisAdvanced workflows:
examples/500_remote_execution_psexec.ipynb - Distributed executionstream_callback usage)Location: ras_commander/RasCmdr.py
Read these docstrings:
RasCmdr.compute_plan() - Lines 139-250+ (comprehensive parameter docs)RasCmdr.compute_parallel() - Parallel execution detailsRasCmdr.compute_test_mode() - Sequential debugging modeCallback protocol: ras_commander/callbacks.py
ExecutionCallback - Protocol definitionConsoleCallback, FileLoggerCallback, ProgressBarCallback - ImplementationsBasic pattern:
from ras_commander import init_ras_project, RasCmdr
# Initialize
init_ras_project("path/to/project", "7.0")
# Execute
RasCmdr.compute_plan("01")
With destination folder (preserves original):
RasCmdr.compute_plan("01", dest_folder="computation_folder")
With monitoring:
from ras_commander.callbacks import ConsoleCallback
RasCmdr.compute_plan(
"01",
stream_callback=ConsoleCallback(verbose=True)
)
Key parameters:
plan_number - "01", "02", etc. (use strings)dest_folder - None = in-place, path = separate foldernum_cores - CPU cores to use (None = plan default)clear_geompre - True after geometry changesverify - True to check completionskip_existing - True to resume interrupted runsstream_callback - Real-time monitoring objectExecute multiple plans:
# All plans with 3 workers
RasCmdr.compute_parallel(max_workers=3, num_cores=2)
# Specific plans
RasCmdr.compute_parallel(
plans_to_run=["01", "02", "03"],
max_workers=3,
num_cores=2
)
Worker allocation:
max_workers - Parallel plan executionsnum_cores - Cores per planmax_workers × num_coresFor debugging:
# Run plans one at a time in test folder
RasCmdr.compute_test_mode(["01", "02", "03"])
Difference from parallel:
To choose between execution modes (single, parallel, sequential, remote, legacy), invoke the hecras_plan_execution skill for decision trees, mode selection matrices, and parameter recommendations.
Read .claude/rules/hec-ras/execution.md for complete mode documentation.
For complex projects, chain execution with inspection and analysis in this order:
1. Project Inspector → Understand project structure
2. Mode Selection → Choose execution approach
3. Execute → Run plans
4. Results Analyst → Interpret outputs
Before executing unfamiliar projects, gather intelligence first:
# Step 1: Inspect project (via hecras-project-inspector agent or manual)
# - Get plan count and types
# - Identify dependencies between plans
# - Check geometry complexity (1D vs 2D vs mixed)
# - Review execution recommendations
# Step 2: Based on inspection, select mode
# Example: Inspector finds 5 independent 2D plans
plans = ["01", "02", "03", "04", "05"]
mode = "compute_parallel" # Independent plans → parallel
# Step 3: Execute with appropriate parameters
RasCmdr.compute_parallel(
plans_to_run=plans,
max_workers=3, # Based on system resources
num_cores=4, # 2D models benefit from multiple cores
verify=True
)
# Step 4: Dispatch to results analysis
# - Extract WSE, velocity, depth from HDF files
# - Generate comparison plots
# - Create summary report
Invoke these upstream skills before execution:
hecras_parse_geometry -- After geometry modificationsdss_read_boundary-data -- After validating boundary conditionsusgs_integrate_gauges -- After setting up gauge-based boundariesInvoke these downstream skills after execution:
hecras_extract_results -- Parse HDF outputsFor workflows spanning multiple HEC-RAS projects:
from ras_commander import RasPrj, init_ras_project, RasCmdr
# Create separate project contexts
projects = {}
for project_name in ["upstream", "downstream", "tributary"]:
projects[project_name] = RasPrj()
init_ras_project(
f"path/to/{project_name}",
"7.0",
ras_object=projects[project_name]
)
# Execute in dependency order
RasCmdr.compute_plan("01", ras_object=projects["upstream"])
RasCmdr.compute_plan("01", ras_object=projects["tributary"])
RasCmdr.compute_plan("01", ras_object=projects["downstream"])
Critical: Pass ras_object when working with multiple projects. See .claude/rules/python/ras-commander-patterns.md for context object discipline.
# Run in separate folder, leave original untouched
RasCmdr.compute_plan(
"01",
dest_folder="results/run_2024_12_11",
overwrite_dest=True,
verify=True
)
from ras_commander.RasGeo import RasGeo
# Modify geometry
RasGeo.update_mannings_n(geom_file="g01", landcover_map={...})
# Run with forced reprocessing
RasCmdr.compute_plan("01", clear_geompre=True) # CRITICAL
scenarios = {
"baseline": {"plan": "01", "dest": "output/baseline"},
"mitigation": {"plan": "02", "dest": "output/mitigation"},
}
for name, config in scenarios.items():
RasCmdr.compute_plan(
config["plan"],
dest_folder=config["dest"],
verify=True
)
# Resume interrupted batch run
for plan in ["01", "02", "03"]:
RasCmdr.compute_plan(
plan,
skip_existing=True, # Skip if already complete
verify=True
)
from ras_commander.callbacks import ConsoleCallback
callback = ConsoleCallback(verbose=True)
RasCmdr.compute_plan("01", stream_callback=callback)
Output example:
[Plan 01] Starting execution...
[Plan 01] Geometry Preprocessor Version 6.6
[Plan 01] Computing Plan: 01
[Plan 01] SUCCESS in 45.2s
from ras_commander.callbacks import FileLoggerCallback
from pathlib import Path
callback = FileLoggerCallback(output_dir=Path("logs"))
RasCmdr.compute_plan("01", stream_callback=callback)
# Creates: logs/plan_01_execution.log
from ras_commander.callbacks import ProgressBarCallback
# Requires: pip install tqdm
callback = ProgressBarCallback()
RasCmdr.compute_plan("01", stream_callback=callback)
from ras_commander.callbacks import ExecutionCallback
class AlertCallback(ExecutionCallback):
def on_exec_complete(self, plan_number: str, success: bool, duration: float):
send_email(subject=f"Plan {plan_number} {'SUCCESS' if success else 'FAILED'}")
RasCmdr.compute_plan("01", stream_callback=AlertCallback())
Available callback methods (all optional):
on_prep_start() - Before geometry preprocessingon_prep_complete() - After preprocessingon_exec_start() - HEC-RAS subprocess startson_exec_message() - Each .bco file message (real-time)on_exec_complete() - Execution finisheson_verify_result() - After verification (if verify=True)Thread safety: Use SynchronizedCallback wrapper for parallel execution
success = RasCmdr.compute_plan("01", verify=True)
if not success:
print("Execution failed or incomplete")
from ras_commander.hdf import HdfResultsPlan
messages = HdfResultsPlan.get_compute_messages("01")
if "Complete Process" in messages:
print("Success!")
wse = HdfResultsPlan.get_wse("01", time_index=-1)
if wse is not None:
print(f"WSE range: {wse.min():.2f} to {wse.max():.2f} ft")
| Setting | Recommendation | When |
|---------|---------------|------|
| clear_geompre=False | 2x-10x faster | Geometry unchanged |
| clear_geompre=True | Required | After ANY geometry edit |
| num_cores=2-4 | Best balance | Most models |
| num_cores=1-2 | Highest efficiency | Resource-limited |
Read .claude/rules/hec-ras/execution.md for detailed performance guidance.
Plan doesn't execute - Check: init_ras_project() called? Plan in ras.plan_df? HEC-RAS installed? Write permissions?
HDF not created - Enable ConsoleCallback(verbose=True), check compute messages, try HEC-RAS GUI manually.
Debug command:
from ras_commander import ras
print(f"Project: {ras.project_folder}")
print(f"RAS: {ras.ras_exe_path}")
print(ras.plan_df)
Rules (follow these):
.claude/rules/hec-ras/execution.md -- Execution mode parameters and performance tuning.claude/rules/python/static-classes.md -- RasCmdr static method pattern.claude/rules/python/decorators.md -- @log_call and @standardize_input usageAgents (delegate when needed):
hecras-general-agent -- Delegate for full inspect-plan-execute-analyze workflowshecras-project-inspector -- Delegate for project analysis before executionSkills (related workflows):
hecras_plan_execution -- Use upstream for execution mode selection and parameter tuninghecras_compute_remote -- Use for distributed remote executionhecras_compute_rascontrol -- Use for legacy COM-based executionhecras_extract_results -- Use downstream to extract results after executionhecras_parse_compute-messages -- Use downstream to verify execution statusPrimary sources:
ras_commander/AGENTS.md -- Plan execution section with complete parameter referenceras_commander/RasCmdr.py -- Source code with comprehensive docstringsexamples/110_single_plan_execution.ipynb -- Single plan workflowexamples/113_parallel_execution.ipynb -- Parallel execution workflownpx skills add gpt-cmdr/hecras_compute_plans下载完整 Skill 目录,包含 SKILL.md 及所有相关文件
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer