Live: CPTViewer
This page runs Python in your browser through marimo WebAssembly islands. The cells below form one reactive notebook: the code is editable, and a change reruns the dependent cells. The first run downloads the Python runtime and the packages, so give it a few seconds.
Fetch a CPT from the BRO
brodata fetches a sounding from the public BRO API and parses the XML. Any reader works here — the viewer only sees tidy columns.
Edit the id above to fetch another public CPT — the whole page reruns with the new sounding.
Tidy the data
Pick the channels, coerce the numeric strings, and compute the vertical coordinate in m NAP from the surface offset:
The DataFrame follows the
data contract: tidy columns of
equal length, one row per depth sample. The constructor handles the
rest — NaN to None, rows sorted to render order.
Pick the channels
The multiselect is a marimo UI element. The viewer cell reads its value, so the chart rebuilds when you change the selection.
Show the viewer
Try the interactions from getting started: hold Ctrl (Cmd on macOS) and turn the mouse wheel to zoom, drag to pan, Shift-drag along the axis to zoom to a range, double-click to reset, and hover to read values.
The built-in column names carry their display defaults — see the
CPTViewer reference for
bindings, limits, overlays, and the editable layer column.