SoilTopography#

Helpers for backslope / front-face topography scripting payloads. Terrain type strings match the RSWall UI (Infinite, Broken, User-defined). Length keys may use alias names (for example x) or historical *Meters wire keys; values are still project-native length.

Helpers for backslope / front-face topography scripting payloads.

Terrain type strings match the RSWall UI (ITerrainDataType.Name).

rswall.SoilTopography.TERRAIN_INFINITE = 'Infinite'#

Infinite.

Type:

Terrain type string matching the RSWall UI

rswall.SoilTopography.TERRAIN_BROKEN = 'Broken'#

Broken.

Type:

Terrain type string matching the RSWall UI

rswall.SoilTopography.TERRAIN_USER_DEFINED = 'User-defined'#

User-defined.

Type:

Terrain type string matching the RSWall UI

rswall.SoilTopography.add_length_aliases(payload, pairs)#

Copy historical *Meters wire keys to alias keys without the suffix (same native-length values).

Return type:

Dict[str, Any]

Parameters:
rswall.SoilTopography.canonicalize_length_keys(payload, pairs)#

Map alias keys onto historical *Meters wire keys. Do not convert as SI.

Return type:

Dict[str, Any]

Parameters:
rswall.SoilTopography.infinite_topography(slope_angle_degrees=None, *, slope_grade=None, define_by_slope_angle=True)#

Build an Infinite terrain payload.

The angle has no default: omitting it raises rather than quietly producing a 0-degree (horizontal) slope that stores successfully. Pass 0.0 explicitly for a flat backslope, e.g. infinite_topography(26.6) for a 26.6 degree slope.

Parameters:
  • slope_angle_degrees (Optional[float]) – Backslope angle in degrees [0, 90). Required unless define_by_slope_angle=False.

  • slope_grade (Optional[float]) – Alternative: slope as a ratio (H:V). Required when define_by_slope_angle=False.

  • define_by_slope_angle (bool) – True → use degrees; False → use slope_grade.

Return type:

Dict[str, Any]

rswall.SoilTopography.broken_topography(x1_offset_meters, x2_offset_meters, *, slope_angle_degrees=None, slope_grade=None, y1_meters=None, define_by_slope_angle=True, defined_by_y1=False)#

Build a Broken terrain (two-segment) payload.

A Broken backslope has a flat initial run (x1), then a sloped section (x2 wide).

Whichever value drives the slope for the selected mode is required: omitting it raises rather than storing a flat 0-degree segment under a successful response.

Parameters:
  • x1_offset_meters (float) – Horizontal distance of the flat initial segment (project units).

  • x2_offset_meters (float) – Horizontal width of the sloped segment (project units).

  • slope_angle_degrees (Optional[float]) – Slope angle of the second segment in degrees [0, 90). Required unless defined_by_y1=True or define_by_slope_angle=False.

  • slope_grade (Optional[float]) – Alternative slope definition (H:V ratio). Required when define_by_slope_angle=False and defined_by_y1=False.

  • y1_meters (Optional[float]) – Vertical height at the top of the sloped segment (project units). Required when defined_by_y1=True.

  • define_by_slope_angle (bool) – True → use slope_angle_degrees; False → use grade or y1.

  • defined_by_y1 (bool) – True → use y1_meters to define the slope height.

Return type:

Dict[str, Any]

rswall.SoilTopography.user_defined_topography(points)#

Build a User-defined terrain payload.

Parameters:

points (List[tuple]) – List of (x, y) tuples in project native length units. Backslope: first point must be (0, 0).

Return type:

Dict[str, Any]

rswall.SoilTopography.terrain_dict_from_proto(topo)#

Convert a TerrainTopographyMsg proto message to a plain dict.

Return type:

Dict[str, Any]

rswall.SoilTopography.canonical_terrain_type(value)#

Resolve a user-supplied terrain type to its canonical spelling.

Accepts any casing plus hyphen/space/underscore variants, so “user defined” and “User-Defined” both reach User-defined. The RSWall service compares terrain types case-insensitively; canonicalizing here keeps the payload builder from silently skipping every branch on a near-miss spelling.

Return type:

str

Parameters:

value (Any)

rswall.SoilTopography.terrain_proto_from_dict(data, soil_service_module)#

Build a TerrainTopographyMsg from a plain dict (requires SoilService pb2 module).

Validates the payload rather than defaulting missing fields, so an omitted or misspelled slope cannot be stored as a flat 0-degree terrain under a successful-looking response.

Return type:

Any

Parameters:

data (Dict[str, Any])