Python data converters for OMF to Evo geoscience objects
Project description
Seequent Developer Portal • Seequent Community • Seequent website
Evo
Evo is a unified platform for geoscience teams. It enables access, connection, computation, and management of subsurface data. This empowers better decision-making, simplified collaboration, and accelerated innovation. Evo is built on open APIs, allowing developers to build custom integrations and applications. Our open schemas, code examples, and SDK are available for the community to use and extend.
Evo is powered by Seequent, a Bentley organisation.
Pre-requisites
- Python >= 3.10, <= 3.12
Installation
Note: This project depends on omf2, which is not available in PyPI yet. You must install it from source before you can use this project.
pip install -e "git+https://github.com/gmggroup/omf-rust.git#egg=omf2&subdirectory=omf-python"
pip install evo-data-converters
OMF
Open Mining Format (OMF) is a standard backed by the Global Mining Guidelines Group.
Refer here for more information: https://omf.readthedocs.io/en/latest/
To work with OMF files the omf2 module is used, which is a Python interface to the omf_rust package:
https://github.com/gmggroup/omf-rust
Publish geoscience objects from an OMF file
Note: For some OMF geometry types there is more than one possible way they could be converted to geoscience objects. For example, an OMF LineSet can be used to represent more than one thing (poly-lines, drillholes, a wireframe mesh, etc). In this example they are converted to LineSegments. Depending on your use case, you may want to convert them to a different geoscience object.
The evo-sdk-common Python library can be used to sign in. After successfully signing in, the user can select an organisation, an Evo hub, and a workspace. Use evo-objects to get an ObjectAPIClient, and evo-data-converters-common to convert your file.
Choose the OMF file you want to publish and set its path in the omf_file variable.
Choose an EPSG code to use for the Coordinate Reference System.
You can also specify tags to add to the created geoscience objects.
Then call convert_omf, passing it the OMF file path, EPSG code, the ObjectAPIClient from above, and finally a path you want the published objects to appear under in your workspace.
Note: Some geometry types are not yet supported. A warning will be shown for each element that could not be converted.
import os
import pprint
from evo.aio import AioTransport
from evo.common import APIConnector
from evo.common.utils import BackoffIncremental
from evo.data_converters.omf.importer import convert_omf
from evo.discovery import DiscoveryAPIClient
from evo.oauth import AuthorizationCodeAuthorizer, OIDCConnector
from evo.objects import ObjectAPIClient
from evo.workspaces import WorkspaceAPIClient
# Configure the transport.
transport = AioTransport(
user_agent="evo-sdk-common-example",
max_attempts=3,
backoff_method=BackoffIncremental(2),
num_pools=4,
verify_ssl=True,
)
# Login to the Evo platform.
# User Login
authorizer = AuthorizationCodeAuthorizer(
redirect_url="<redirect_url>",
oidc_connector=OIDCConnector(
transport=transport,
oidc_issuer="<issuer_url>",
client_id="<client_id>",
),
)
await authorizer.login()
# Select an Organization.
async with APIConnector("https://discover.api.seequent.com", transport, authorizer) as api_connector:
discovery_client = DiscoveryAPIClient(api_connector)
organizations = await discovery_client.list_organizations()
selected_org = organizations[0]
# Select a hub and create a connector.
hub_connector = APIConnector(selected_org.hubs[0].url, transport, authorizer)
# Select a Workspace.
async with hub_connector:
workspace_client = WorkspaceAPIClient(hub_connector, selected_org.id)
workspaces = await workspace_client.list_workspaces()
workspace = workspaces[0]
workspace_env = workspace.get_environment()
# Convert your object.
async with hub_connector:
service_client = ObjectAPIClient(workspace_env, hub_connector)
omf_file = os.path.join(os.getcwd(), "data/input/one_of_everything.omf")
epsg_code = 32650
tags = {"TagName": "Tag value"}
objects_metadata = convert_omf(
filepath=omf_file,
epsg_code=epsg_code,
object_service_client=service_client,
tags=tags,
upload_path="path/to/my/object"
)
print("These objects have now been published:")
for metadata in objects_metadata:
pprint.pp(metadata, indent=4)
Export objects to OMF
To export an object from Evo to an OMF file, specify the Evo object UUID of the object you want to export and the output file path, and then call export_omf().
See documentation on the ObjectAPIClient for listing objects and getting their IDs and versions.
You may also specify the version of this object to export. If not specified, so it will export the latest version.
You will need the same selection of organisation, Evo hub, and workspace that is needed for importing objects.
Note: Some geoscience object types are not yet supported.
import os
from uuid import UUID
from evo.data_converters.common import EvoObjectMetadata
from evo.data_converters.omf.exporter import export_omf
objects = []
objects.append(
EvoObjectMetadata(
object_id=UUID("<object_id>"),
version_id="<version_id>"))
output_dir = "data/output"
os.makedirs(output_dir, exist_ok=True)
output_file = f"{output_dir}/object.omf"
export_omf(
filepath=output_file,
objects=objects,
service_client=service_client,
)
Block models
Block models can be imported using the standard convert_omf function.
Block models work a little bit differently for export. These use a BlockSyncClient rather than the ObjectAPIClient to access models stored in BlockSync. Create a BlockSyncClient using the Environment and APIConnector in the same way you would create and ObjectAPIClient.
from evo.data_converters.common import BlockSyncClient
blocksync_client = BlockSyncClient(workspace_env, hub_connector)
Export a block model to OMF V1
Specify the block model UUID of the block model object you want to export and the output file path, then call export_blocksync_omf().
Note: At this stage only Regular block model types are supported.
import os
from uuid import UUID
from evo.data_converters.omf.exporter import export_blocksync_omf
object_id = ""
version_id = None
output_dir = "data/output"
os.makedirs(output_dir, exist_ok=True)
output_file = f"{output_dir}/{object_id}.omf"
export_blocksync_omf(
filepath=output_file,
object_id=UUID(object_id),
version_id=version_id,
service_client=blocksync_client,
)
print(f"File saved to {output_file}")
Download Parquet file only
import shutil
import pyarrow.parquet as pq
object_id = ""
dest_file = f"data/output/{object_id}.parquet"
job_url = blocksync_client.get_blockmodel_columns_job_url(object_id)
download_url = blocksync_client.get_blockmodel_columns_download_url(job_url)
downloaded_file = blocksync_client.download_parquet(download_url)
shutil.copy(downloaded_file.name, dest_file)
table = pq.read_table(dest_file)
for column in table.column_names:
print(f"{column} is of type: {table.schema.field(column).type}")
Code of conduct
We rely on an open, friendly, inclusive environment. To help us ensure this remains possible, please familiarise yourself with our code of conduct.
License
Evo data converters are open source and licensed under the Apache 2.0 license.
Copyright © 2025 Bentley Systems, Incorporated.
Licensed under the Apache License, Version 2.0 (the "License"). You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file evo_data_converters_omf-0.1.0.tar.gz.
File metadata
- Download URL: evo_data_converters_omf-0.1.0.tar.gz
- Upload date:
- Size: 38.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
950074d1e5d60e84e94d2e7ec3730ef0aa5936f86a12b20b90936ca7fc3b5a37
|
|
| MD5 |
ce41586fbe91c3c64fb69803cbcbb0e4
|
|
| BLAKE2b-256 |
f85e1cb6d91794e4b16d6d20cb2b6d27ebad5fe5b25bf1b9b7908f8ebaa25b5f
|
Provenance
The following attestation bundles were made for evo_data_converters_omf-0.1.0.tar.gz:
Publisher:
publish-omf.yaml on SeequentEvo/evo-data-converters
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
evo_data_converters_omf-0.1.0.tar.gz -
Subject digest:
950074d1e5d60e84e94d2e7ec3730ef0aa5936f86a12b20b90936ca7fc3b5a37 - Sigstore transparency entry: 205690230
- Sigstore integration time:
-
Permalink:
SeequentEvo/evo-data-converters@2a4889324e691e462ff686e11e8c7d4abd50ce3a -
Branch / Tag:
refs/tags/evo-data-converters-omf@v0.1.0 - Owner: https://github.com/SeequentEvo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-omf.yaml@2a4889324e691e462ff686e11e8c7d4abd50ce3a -
Trigger Event:
release
-
Statement type:
File details
Details for the file evo_data_converters_omf-0.1.0-py3-none-any.whl.
File metadata
- Download URL: evo_data_converters_omf-0.1.0-py3-none-any.whl
- Upload date:
- Size: 46.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4d19277744502444950a187119e219d6a433adb6e443d5939f5f6301eccf76b7
|
|
| MD5 |
d56709fbed0eaddbd40a7a6dd39b6b4f
|
|
| BLAKE2b-256 |
df10cce8141f0b64d123b5d309b3065fc43fbddfacfe750342e50b779568ee4d
|
Provenance
The following attestation bundles were made for evo_data_converters_omf-0.1.0-py3-none-any.whl:
Publisher:
publish-omf.yaml on SeequentEvo/evo-data-converters
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
evo_data_converters_omf-0.1.0-py3-none-any.whl -
Subject digest:
4d19277744502444950a187119e219d6a433adb6e443d5939f5f6301eccf76b7 - Sigstore transparency entry: 205690233
- Sigstore integration time:
-
Permalink:
SeequentEvo/evo-data-converters@2a4889324e691e462ff686e11e8c7d4abd50ce3a -
Branch / Tag:
refs/tags/evo-data-converters-omf@v0.1.0 - Owner: https://github.com/SeequentEvo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-omf.yaml@2a4889324e691e462ff686e11e8c7d4abd50ce3a -
Trigger Event:
release
-
Statement type: