Object/Data Selection

This simple application lets users select objects and data stored in the target geoh5 project.

New user? Visit the Getting Started page.

[1]:
from geoapps.base.selection import ObjectDataSelection
app = ObjectDataSelection(
    h5file=r"../../../assets/FlinFlon.geoh5",
    objects="{79b719bc-d996-4f52-9af0-10aa9c7bb941}" # For demonstration
)
app()

Notes: - The list of available Objects is preceded by the group name they belong to (e.g. Workspace/geochem), such that multiple objects with the same name can easily be differentiated.

  • The names displayed in the Object and Data ipywidgets.dropdown options are linked internally to the unique identifier (uid) of entities, as a {name: uid} value pair.

  • Both menus are linked together with an observer, such that the list of available Data is updated on selection of an object.

Optional

Alternatively, the Data selection can be converted to an ipywidget.SelectMultiple using the select_multiple option on instantiation:

[2]:
app = ObjectDataSelection(
    select_multiple=True,
    h5file=r"../../../assets/FlinFlon.geoh5",
    objects="{79b719bc-d996-4f52-9af0-10aa9c7bb941}",
    data=[
        "{cdd7668a-4b5b-49ac-9365-c9ce4fddf733}",
        "{cb35da1c-7ea4-44f0-8817-e3d80e8ba98c}"
    ]# For demonstration
)
app()

[3]:
app.data.value
[3]:
(UUID('cdd7668a-4b5b-49ac-9365-c9ce4fddf733'),
 UUID('cb35da1c-7ea4-44f0-8817-e3d80e8ba98c'))

Accessing selection

Selected Object and Data names can be accessed from their respective value property:

[4]:
app.objects.value
[4]:
UUID('79b719bc-d996-4f52-9af0-10aa9c7bb941')

Alternatively, the application can return geoh5py.entities:

[5]:
app.get_selected_entities()
[5]:
(<geoh5py.objects.points.Points at 0x1e469a21fa0>,
 [<geoh5py.data.float_data.FloatData at 0x1e469a4a790>,
  <geoh5py.data.float_data.FloatData at 0x1e469a4a6d0>])

from which data values and geometry can be accessed, manipulated and visualized.

Below is a quick example using a built-in plotly wrapper.

[6]:
from geoapps.utils.plotting import plotly_scatter

points, data = app.get_selected_entities()
figure = plotly_scatter(points, color=data[1], size=data[0])
figure.show()

Need help? Contact us at support@mirageoscience.com