Index
subsurfaceio.cross_section
CAD-native geotechnical cross-section export.
Place in-situ tests along a horizontal section, then write a DXF with strata and parameter columns. Build from a site investigation and export:
from subsurfaceio.cross_section import CrossSection
section = CrossSection.from_site(site)
section.to_dxf('section.dxf')
Modules:
| Name | Description |
|---|---|
data_access |
Depth/elevation mapping and test data helpers for cross-section export. |
layouts |
Default column templates per in-situ test type. |
render |
Cross-section DXF rendering. |
Classes:
| Name | Description |
|---|---|
CrossSection |
Geotechnical cross-section definition for CAD export. |
CrossSectionStation |
One in-situ test placed along the section horizontal axis. |
CrossSectionTemplate |
Ordered column layout for one test type. |
PlotColumnSpec |
A parameter plot column (line/marker chart vs depth or elevation). |
PlotSeriesSpec |
One data series drawn inside a plot column. |
StrataColumnSpec |
A labeled strata interval column. |
Attributes:
| Name | Type | Description |
|---|---|---|
ColumnSpec |
TypeAlias
|
Discriminated plot or strata column in a template. |
DrawStyle |
TypeAlias
|
Line interpolation between samples. |
MarkerStyle |
TypeAlias
|
Marker drawn at each sample. |
MergedTestData |
TypeAlias
|
Column-oriented raw and interpretation fields for one test. |
VerticalAxis |
TypeAlias
|
Section vertical coordinate; depth increases downward. |
XScale |
TypeAlias
|
Horizontal axis scale for a plot column. |
ColumnSpec
module-attribute
ColumnSpec: TypeAlias = Annotated[
PlotColumnSpec | StrataColumnSpec,
Field(discriminator="column_type"),
]
Discriminated plot or strata column in a template.
DrawStyle
module-attribute
Line interpolation between samples.
MarkerStyle
module-attribute
Marker drawn at each sample.
MergedTestData
module-attribute
Column-oriented raw and interpretation fields for one test.
VerticalAxis
module-attribute
Section vertical coordinate; depth increases downward.
XScale
module-attribute
Horizontal axis scale for a plot column.
CrossSection
pydantic-model
Bases: BaseModel
Geotechnical cross-section definition for CAD export.
Coordinates are in meters. Create with
from_site, then call
to_dxf to write a DXF
file.
Attributes:
| Name | Type | Description |
|---|---|---|
project_metadata |
ProjectMetadata | None
|
Copied from the site when built with |
stations |
list[CrossSectionStation]
|
Tests placed along the section. |
vertical |
VerticalAxis
|
Vertical axis; |
template_overrides |
dict[str, CrossSectionTemplate]
|
Per-test-type column layouts replacing defaults. |
y_top_m |
float | None
|
Optional section-wide top elevation/depth bound (m). |
y_bottom_m |
float | None
|
Optional section-wide bottom elevation/depth bound (m). |
strata_label_height_m |
float
|
DXF text height for strata labels. |
axis_width_m |
float
|
Width of the shared vertical axis gutter (m). |
station_gap_m |
float
|
Horizontal gap inserted between auto-placed stations (m). |
Fields:
-
project_metadata(ProjectMetadata | None) -
stations(list[CrossSectionStation]) -
vertical(VerticalAxis) -
template_overrides(dict[str, CrossSectionTemplate]) -
y_top_m(float | None) -
y_bottom_m(float | None) -
strata_label_height_m(float) -
axis_width_m(float) -
station_gap_m(float)
station_gap_m
pydantic-field
Horizontal gap inserted between auto-placed stations (m).
y_bottom_m
pydantic-field
Optional section-wide bottom elevation/depth bound (m).
y_top_m
pydantic-field
Optional section-wide top elevation/depth bound (m).
from_site
classmethod
from_site(
site: SiteInvestigation,
stations: list[CrossSectionStation] | None = None,
*,
vertical: VerticalAxis = "elevation",
**kwargs: Any
) -> Self
Build a cross-section from a site investigation.
When stations is omitted, one station is created per in-situ test on
site, laid out left-to-right using each template width plus
station_gap_m. Filter site first with
get_tests_by_ids
when only a subset should appear on the section.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
site
|
SiteInvestigation
|
Site investigation supplying tests and project metadata. |
required |
stations
|
list[CrossSectionStation] | None
|
Optional explicit station placements. When omitted, one station is created per in-situ test. |
None
|
vertical
|
VerticalAxis
|
Vertical axis; |
'elevation'
|
**kwargs
|
Any
|
Extra |
{}
|
Returns:
| Type | Description |
|---|---|
Self
|
A section bound to |
resolve_template
Return the column template for test_type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
test_type
|
str
|
In-situ test type code such as |
required |
Returns:
| Type | Description |
|---|---|
CrossSectionTemplate
|
Override from |
station_width_m
Total rendered width of one station for test_type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
test_type
|
str
|
In-situ test type code such as |
required |
Returns:
| Type | Description |
|---|---|
float
|
Sum of column widths in the resolved template, in meters. |
CrossSectionStation
pydantic-model
CrossSectionTemplate
pydantic-model
Bases: BaseModel
Ordered column layout for one test type.
Attributes:
| Name | Type | Description |
|---|---|---|
columns |
list[ColumnSpec]
|
Plot and strata columns from left to right. |
Fields:
-
columns(list[ColumnSpec])
PlotColumnSpec
pydantic-model
Bases: BaseModel
A parameter plot column (line/marker chart vs depth or elevation).
Attributes:
| Name | Type | Description |
|---|---|---|
column_type |
Literal['plot']
|
Union tag; must be |
width_m |
float
|
Column width in section meters. |
series |
list[PlotSeriesSpec]
|
Data series drawn in this column. |
x_scale |
XScale
|
Horizontal axis scale. |
x_min |
float | None
|
Optional lower x-limit. |
x_max |
float | None
|
Optional upper x-limit. |
invert_x |
bool
|
If True, the x-axis runs right to left. |
title |
str | None
|
Column header, or |
reference_lines |
list[float]
|
Vertical reference values in data units. |
Fields:
-
column_type(Literal['plot']) -
width_m(float) -
series(list[PlotSeriesSpec]) -
x_scale(XScale) -
x_min(float | None) -
x_max(float | None) -
invert_x(bool) -
title(str | None) -
reference_lines(list[float])
PlotSeriesSpec
pydantic-model
Bases: BaseModel
One data series drawn inside a plot column.
Attributes:
| Name | Type | Description |
|---|---|---|
x_field |
str
|
Data field plotted on the horizontal axis. |
y_field |
str
|
Vertical field; typically |
color |
int
|
ACI color index. |
marker |
MarkerStyle
|
Marker drawn at samples. |
drawstyle |
DrawStyle
|
Line interpolation style. |
Fields:
StrataColumnSpec
pydantic-model
Bases: BaseModel
A labeled strata interval column.
Attributes:
| Name | Type | Description |
|---|---|---|
column_type |
Literal['strata']
|
Union tag; must be |
width_m |
float
|
Column width in section meters. |
Fields:
-
column_type(Literal['strata']) -
width_m(float)