Skip to content

Context

subsurfaceio.logplot.render.context

Page-level render context passed to column renderers.

Classes:

Name Description
RenderContext

Page-level geometry and state for a column renderer.

RenderContext dataclass

Page-level geometry and state for a column renderer.

Passed explicitly rather than accessed via LogPlot internals so each renderer stays independently testable.

Methods:

Name Description
get_filtered_records

Return records whose y range intersects the current page.

y_to_px

Convert a depth delta (from page top) to pixels.

Attributes:

Name Type Description
content_width float
data_dump dict[str, Any]
metadata LogPlotMetadata
page_y_bottom float
page_y_top float
report_body_height float
svg_definitions SVGDefinitions
y_values_per_page float

content_width instance-attribute

content_width: float

data_dump instance-attribute

data_dump: dict[str, Any]

metadata instance-attribute

metadata: LogPlotMetadata

page_y_bottom instance-attribute

page_y_bottom: float

page_y_top instance-attribute

page_y_top: float

report_body_height instance-attribute

report_body_height: float

svg_definitions instance-attribute

svg_definitions: SVGDefinitions

y_values_per_page instance-attribute

y_values_per_page: float

get_filtered_records

get_filtered_records(
    model: _IntervalFields,
    data_records: list[dict[str, Any]],
) -> list[dict[str, Any]]

Return records whose y range intersects the current page.

Parameters:

Name Type Description Default
model _IntervalFields

Column model exposing y_top_field / y_bottom_field.

required
data_records list[dict[str, Any]]

Dumped rows from data_dump[data_source].

required

Returns:

Type Description
list[dict[str, Any]]

Records that overlap [page_y_top, page_y_bottom). Point records (y_bottom is None) are included when y_top falls inside the page.

y_to_px

y_to_px(value: float) -> float

Convert a depth delta (from page top) to pixels.

Parameters:

Name Type Description Default
value float

Depth/elevation delta in the same units as y_values_per_page.

required

Returns:

Type Description
float

Pixel offset from the top of the report body.