Skip to main content

loop-link

Send geoscience data from Python to the LoopConnect viewer.

Install

pip install loop-link

Optional extras: pyvista, loopstructural, pandas.

Token

The package needs a token. It reads the GEOVIEWER_TOKEN environment variable. If this variable is not set, it uses the token that the viewer saved.

Example

import numpy as np
from loop_link import Viewer, Points

viewer = Viewer()
xyz = np.random.rand(100, 3)
viewer.connect()
viewer.send(Points(xyz), id="random-points", name="random points")
viewer.close()

Select and fetch

from loop_link import Viewer, BlockModel

grid = BlockModel((0, 0, 0), (1, 1, 1), (4, 4, 4))
viewer = Viewer()
viewer.send(grid, id="grid")
viewer.select("grid", cells=[12, 13])
sel = viewer.selection()
print(sel.object_id, sel.cells)
watcher = viewer.watch_selection(print, interval=0.5)
watcher.stop()
result = viewer.fetch("grid")
print(result.object)

Select, read and fetch use the tool connection. They work while another program holds the data connection. A viewer without geoviewer protocol 1.18 gives MissingFeatureError. A fetch of a drillhole keeps the first interval set. It warns about dropped properties.

Filter and colour

from loop_link import BlockModel, ColourSettings, Viewer

grid = BlockModel((0, 0, 0), (1, 1, 1), (4, 4, 4))
viewer = Viewer()
viewer.send(grid, id="grid", colour=ColourSettings(array="grade", colour_map="viridis", range=(0.0, 1.0), scale="linear"))
result = viewer.filter_range("grid", "grade", 0.5, 1.0)
print(result.passing, result.total)
viewer.filter_values("grid", "unit", [0, 2], exclude=True)
viewer.filter_remove("grid", "grade")
viewer.set_colour_map("grid", "coolwarm")
print(viewer.colour_map_names())

Filter and colour use the tool connection. They work while another program holds the data connection. The colour map names come from the viewer. A viewer without geoviewer protocol 1.18 gives MissingFeatureError for colour_map_names(). A filter call waits for the end of the build by default. wait=False does not wait, cancel is a threading.Event, and progress gets the fraction. The counts need a viewer of protocol 1.20. An older viewer gives a FilterResult with no counts. state is building when the viewer stopped to wait (the build goes on) and unbuilt when the viewer has no counts for the new filters. A value filter uses the integer ids of the categories. These are the codes of Categorical.

Test against the real codec

Some tests give the frames of loop_link to the real geoviewer codec. The geoviewer repository is private, so these tests are optional. Set LOOP_LINK_GEOVIEWER_REPO to a geoviewer checkout and install Rust (cargo). The tests build a small validator program the first time that they run. Without the variable, or without cargo, these tests skip.

Metadata

Release files for loop-link 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for loop-link 0.1.0
File Size Uploaded Provenance Actions
loop_link-0.1.0.tar.gz 140.8 kB With provenance Details for loop_link-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for loop-link 0.1.0
File Interpreter ABI Platform Actions
loop_link-0.1.0-py3-none-any.whl Python 3 none any Details for loop_link-0.1.0-py3-none-any.whl

Total release size: 219.8 kB

Security for loop-link 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page