xiaohongshu
xiaohongshu
hecras_parse_geometry
Parses and modifies HEC-RAS plain text geometry files (.g##) using fixed-width FORTRAN format. Handles cross sections, storage areas, bridges, culverts, lateral structures, and Manning's n tables. Use when reading geometry files, modifying cross sections, updating roughness, extracting structure ...
Full skill instructions
Primary Sources (navigate to these for details):
ras_commander/geom/AGENTS.md (parsing algorithms, API reference)examples/201_1d_plaintext_geometry.ipynb and examples/202_2d_plaintext_geometry.ipynb (comprehensive demonstrations)This skill provides quick-reference patterns for common tasks. For implementation details, parsing algorithms, and complete API documentation, see the primary sources above.
from ras_commander.geom.GeomCrossSection import GeomCrossSection
# List all cross sections in file
xs_df = GeomCrossSection.get_cross_sections("model.g01")
# Returns: DataFrame with River, Reach, RS, NodeName
# Filter by river/reach
xs_df = GeomCrossSection.get_cross_sections(
"model.g01",
river="Ohio River",
reach="Reach 1"
)
# Get station-elevation profile
df = GeomCrossSection.get_station_elevation(
"model.g01",
"Ohio River",
"Reach 1",
"1000"
)
# Returns: DataFrame with Station, Elevation columns
# Get bank stations
banks = GeomCrossSection.get_bank_stations(
"model.g01",
"Ohio River",
"Reach 1",
"1000"
)
# Returns: dict with BankLeft, BankRight keys
# Read current geometry
df = GeomCrossSection.get_station_elevation(
"model.g01",
"Ohio River",
"Reach 1",
"1000"
)
# Modify elevations (e.g., lower channel 2 feet)
df.loc[df['Station'].between(100, 200), 'Elevation'] -= 2.0
# Get bank stations
banks = GeomCrossSection.get_bank_stations(
"model.g01",
"Ohio River",
"Reach 1",
"1000"
)
# Write back (creates .bak backup, handles bank interpolation)
GeomCrossSection.set_station_elevation(
"model.g01",
"Ohio River",
"Reach 1",
"1000",
df,
bank_left=banks['BankLeft'],
bank_right=banks['BankRight']
)
from ras_commander.geom.GeomLandCover import GeomLandCover
# Read land cover table
lc_df = GeomLandCover.get_base_mannings_n("model.g01")
# Returns: DataFrame with LandCoverID, ManningsN
# Modify roughness
lc_df.loc[lc_df['LandCoverID'] == 42, 'ManningsN'] = 0.15
# Write back (creates .bak backup)
GeomLandCover.set_base_mannings_n("model.g01", lc_df)
from ras_commander.geom.GeomStorage import GeomStorage
# List storage areas (exclude 2D flow areas)
storage_areas = GeomStorage.get_storage_areas("model.g01", exclude_2d=True)
# Get elevation-volume curve
df = GeomStorage.get_elevation_volume("model.g01", "Detention Basin 1")
# Returns: DataFrame with Elevation, Area, Volume columns
from ras_commander.geom.GeomBridge import GeomBridge
# List all bridges
bridges = GeomBridge.get_bridges("model.g01")
# Get bridge deck geometry
deck_df = GeomBridge.get_deck(
"model.g01",
"Ohio River",
"Reach 1",
"1000"
)
# Returns: DataFrame with Station, Elevation, Width, Distance
# Get pier data
piers_df = GeomBridge.get_piers(
"model.g01",
"Ohio River",
"Reach 1",
"1000"
)
# Returns: DataFrame with Station, Width, CD coefficients
from ras_commander.geom.GeomCulvert import GeomCulvert
# Get all culverts in file
culverts_df = GeomCulvert.get_all("model.g01")
# Returns: DataFrame with River, Reach, RS, CulvertNum, Shape, etc.
# Filter by river/reach
culverts_df = GeomCulvert.get_all(
"model.g01",
river="Ohio River",
reach="Reach 1"
)
# Culvert shape codes:
# 1=Circular, 2=Box, 3=Pipe Arch, 4=Ellipse, 5=Arch
# 6=Semi-Circle, 7=Low Profile Arch, 8=High Profile Arch, 9=Con Span
| Module | Class | Purpose |
|---|---|---|
| GeomParser | GeomParser | Fixed-width format parsing utilities |
| GeomCrossSection | GeomCrossSection | 1D cross section operations |
| GeomStorage | GeomStorage | Storage area elevation-volume curves |
| GeomLandCover | GeomLandCover | 2D Manning's n land cover tables |
| GeomLateral | GeomLateral | Lateral structures and SA/2D connections |
| GeomInlineWeir | GeomInlineWeir | Inline weir structures |
| GeomBridge | GeomBridge | Bridge/culvert structure geometry |
| GeomCulvert | GeomCulvert | Culvert data extraction |
| GeomPreprocessor | GeomPreprocessor | Geometry preprocessor file management |
See ras_commander/geom/AGENTS.md for complete API documentation.
Handled automatically - set_station_elevation() ensures bank stations appear as exact points:
HEC-RAS enforces maximum 450 points per cross section:
# Validate before writing
if len(df) > 450:
raise ValueError(f"Cross section has {len(df)} points (max 450)")
River, Reach, and RS are case-sensitive:
# These are DIFFERENT:
GeomCrossSection.get_station_elevation(geom_file, "Ohio River", ...)
GeomCrossSection.get_station_elevation(geom_file, "ohio river", ...)
Use exact casing from get_cross_sections() DataFrame.
All write operations create .bak files:
Original: model.g01
Modified: model.g01
Backup: model.g01.bak
HEC-RAS uses FORTRAN-era formatting:
#Sta/Elev= 40 means 40 PAIRS (80 total values)See ras_commander/geom/AGENTS.md for parsing algorithm details.
# Get list of all cross sections
xs_df = GeomCrossSection.get_cross_sections("model.g01")
# Iterate through each
for _, row in xs_df.iterrows():
river = row['River']
reach = row['Reach']
rs = row['RS']
# Read geometry
df = GeomCrossSection.get_station_elevation("model.g01", river, reach, rs)
# Apply modification (e.g., raise all elevations 1 foot)
df['Elevation'] += 1.0
# Get bank stations
banks = GeomCrossSection.get_bank_stations("model.g01", river, reach, rs)
# Write back
GeomCrossSection.set_station_elevation(
"model.g01",
river,
reach,
rs,
df,
bank_left=banks['BankLeft'],
bank_right=banks['BankRight']
)
from ras_commander.geom.GeomStorage import GeomStorage
# List storage areas (exclude 2D flow areas)
storage_areas = GeomStorage.get_storage_areas("model.g01", exclude_2d=True)
# Extract elevation-volume curves
for area_name in storage_areas:
df = GeomStorage.get_elevation_volume("model.g01", area_name)
print(f"{area_name}: {len(df)} elevation points")
# df has columns: Elevation, Area, Volume
from ras_commander.geom.GeomCulvert import GeomCulvert
# Get all culverts in file
culverts_df = GeomCulvert.get_all("model.g01")
# Interpret shape codes
shape_map = {
1: "Circular", 2: "Box", 3: "Pipe Arch", 4: "Ellipse",
5: "Arch", 6: "Semi-Circle", 7: "Low Profile Arch",
8: "High Profile Arch", 9: "Con Span"
}
for _, row in culverts_df.iterrows():
shape_name = shape_map[row['Shape']]
print(f"{row['River']} - {row['RS']}: {shape_name} culvert")
from pathlib import Path
# Verify file exists
if not Path(geom_file).exists():
raise FileNotFoundError(f"Geometry file not found: {geom_file}")
# List available features first
xs_df = GeomCrossSection.get_cross_sections(geom_file)
print(xs_df[['River', 'Reach', 'RS']])
# Use exact casing
df = GeomCrossSection.get_station_elevation(
geom_file,
"Ohio River", # Exact case
"Reach 1", # Exact case
"1000" # Exact string
)
# Validate before writing
if len(df) > 450:
# Option 1: Simplify geometry
from scipy.interpolate import interp1d
f = interp1d(df['Station'], df['Elevation'])
new_stations = np.linspace(df['Station'].min(), df['Station'].max(), 400)
df = pd.DataFrame({
'Station': new_stations,
'Elevation': f(new_stations)
})
# Option 2: Raise error for user to handle
raise ValueError(f"Cross section has {len(df)} points (max 450)")
For complete details, navigate to:
ras_commander/geom/AGENTS.md
examples/201_1d_plaintext_geometry.ipynb and examples/202_2d_plaintext_geometry.ipynb
All classes use static methods - no instantiation required:
from ras_commander.geom.GeomCrossSection import GeomCrossSection
from ras_commander.geom.GeomStorage import GeomStorage
from ras_commander.geom.GeomBridge import GeomBridge
from ras_commander.geom.GeomCulvert import GeomCulvert
from ras_commander.geom.GeomLandCover import GeomLandCover
# Use directly (no instantiation)
xs_df = GeomCrossSection.get_cross_sections("model.g01")
.claude/agents/geometry-parser/SUBAGENT.md - For delegationxiaohongshu
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