evo-data-converters-omf 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- evo_data_converters_omf-0.1.0/LICENSE.md +190 -0
- evo_data_converters_omf-0.1.0/PKG-INFO +261 -0
- evo_data_converters_omf-0.1.0/README.md +247 -0
- evo_data_converters_omf-0.1.0/pyproject.toml +34 -0
- evo_data_converters_omf-0.1.0/setup.cfg +4 -0
- evo_data_converters_omf-0.1.0/src/evo/data_converters/omf/__init__.py +16 -0
- evo_data_converters_omf-0.1.0/src/evo/data_converters/omf/exporter/__init__.py +30 -0
- evo_data_converters_omf-0.1.0/src/evo/data_converters/omf/exporter/blocksync_to_omf.py +221 -0
- evo_data_converters_omf-0.1.0/src/evo/data_converters/omf/exporter/evo_attributes_to_omf.py +276 -0
- evo_data_converters_omf-0.1.0/src/evo/data_converters/omf/exporter/evo_lineset_to_omf.py +78 -0
- evo_data_converters_omf-0.1.0/src/evo/data_converters/omf/exporter/evo_pointset_to_omf.py +45 -0
- evo_data_converters_omf-0.1.0/src/evo/data_converters/omf/exporter/evo_surface_to_omf.py +85 -0
- evo_data_converters_omf-0.1.0/src/evo/data_converters/omf/exporter/evo_to_omf.py +158 -0
- evo_data_converters_omf-0.1.0/src/evo/data_converters/omf/exporter/utils.py +119 -0
- evo_data_converters_omf-0.1.0/src/evo/data_converters/omf/importer/__init__.py +26 -0
- evo_data_converters_omf-0.1.0/src/evo/data_converters/omf/importer/blockmodel/__init__.py +26 -0
- evo_data_converters_omf-0.1.0/src/evo/data_converters/omf/importer/blockmodel/omf_attributes_to_blocksync.py +125 -0
- evo_data_converters_omf-0.1.0/src/evo/data_converters/omf/importer/blockmodel/omf_blockmodel_to_blocksync.py +415 -0
- evo_data_converters_omf-0.1.0/src/evo/data_converters/omf/importer/blockmodel/utils.py +189 -0
- evo_data_converters_omf-0.1.0/src/evo/data_converters/omf/importer/omf_attributes_to_evo.py +350 -0
- evo_data_converters_omf-0.1.0/src/evo/data_converters/omf/importer/omf_blockmodel_to_evo.py +103 -0
- evo_data_converters_omf-0.1.0/src/evo/data_converters/omf/importer/omf_lineset_to_evo.py +89 -0
- evo_data_converters_omf-0.1.0/src/evo/data_converters/omf/importer/omf_pointset_to_evo.py +77 -0
- evo_data_converters_omf-0.1.0/src/evo/data_converters/omf/importer/omf_surface_to_evo.py +90 -0
- evo_data_converters_omf-0.1.0/src/evo/data_converters/omf/importer/omf_to_evo.py +133 -0
- evo_data_converters_omf-0.1.0/src/evo/data_converters/omf/omf_metadata.py +34 -0
- evo_data_converters_omf-0.1.0/src/evo/data_converters/omf/omf_reader_context.py +59 -0
- evo_data_converters_omf-0.1.0/src/evo/data_converters/omf/utils.py +30 -0
- evo_data_converters_omf-0.1.0/src/evo_data_converters_omf.egg-info/PKG-INFO +261 -0
- evo_data_converters_omf-0.1.0/src/evo_data_converters_omf.egg-info/SOURCES.txt +39 -0
- evo_data_converters_omf-0.1.0/src/evo_data_converters_omf.egg-info/dependency_links.txt +1 -0
- evo_data_converters_omf-0.1.0/src/evo_data_converters_omf.egg-info/requires.txt +4 -0
- evo_data_converters_omf-0.1.0/src/evo_data_converters_omf.egg-info/top_level.txt +1 -0
- evo_data_converters_omf-0.1.0/tests/test_evo_client.py +41 -0
- evo_data_converters_omf-0.1.0/tests/test_is_omf.py +39 -0
- evo_data_converters_omf-0.1.0/tests/test_omf_attribute_to_evo.py +685 -0
- evo_data_converters_omf-0.1.0/tests/test_omf_file_handler.py +38 -0
- evo_data_converters_omf-0.1.0/tests/test_omf_lineset_to_evo.py +333 -0
- evo_data_converters_omf-0.1.0/tests/test_omf_pointset_to_evo.py +86 -0
- evo_data_converters_omf-0.1.0/tests/test_omf_surface_to_evo.py +339 -0
- evo_data_converters_omf-0.1.0/tests/test_omf_to_evo.py +71 -0
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
Copyright © 2025 Bentley Systems, Incorporated.
|
|
2
|
+
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License.
|
|
5
|
+
You may obtain a copy of the License at
|
|
6
|
+
|
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
|
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
See the License for the specific language governing permissions and
|
|
13
|
+
limitations under the License.
|
|
14
|
+
|
|
15
|
+
Apache License
|
|
16
|
+
Version 2.0, January 2004
|
|
17
|
+
http://www.apache.org/licenses/
|
|
18
|
+
|
|
19
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
20
|
+
|
|
21
|
+
1. Definitions.
|
|
22
|
+
|
|
23
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
24
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
25
|
+
|
|
26
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
27
|
+
the copyright owner that is granting the License.
|
|
28
|
+
|
|
29
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
30
|
+
other entities that control, are controlled by, or are under common
|
|
31
|
+
control with that entity. For the purposes of this definition,
|
|
32
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
33
|
+
direction or management of such entity, whether by contract or
|
|
34
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
35
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
36
|
+
|
|
37
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
38
|
+
exercising permissions granted by this License.
|
|
39
|
+
|
|
40
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
41
|
+
including but not limited to software source code, documentation
|
|
42
|
+
source, and configuration files.
|
|
43
|
+
|
|
44
|
+
"Object" form shall mean any form resulting from mechanical
|
|
45
|
+
transformation or translation of a Source form, including but
|
|
46
|
+
not limited to compiled object code, generated documentation,
|
|
47
|
+
and conversions to other media types.
|
|
48
|
+
|
|
49
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
50
|
+
Object form, made available under the License, as indicated by a
|
|
51
|
+
copyright notice that is included in or attached to the work
|
|
52
|
+
(an example is provided in the Appendix below).
|
|
53
|
+
|
|
54
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
55
|
+
form, that is based on (or derived from) the Work and for which the
|
|
56
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
57
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
58
|
+
of this License, Derivative Works shall not include works that remain
|
|
59
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
60
|
+
the Work and Derivative Works thereof.
|
|
61
|
+
|
|
62
|
+
"Contribution" shall mean any work of authorship, including
|
|
63
|
+
the original version of the Work and any modifications or additions
|
|
64
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
65
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
66
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
67
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
68
|
+
means any form of electronic, verbal, or written communication sent
|
|
69
|
+
to the Licensor or its representatives, including but not limited to
|
|
70
|
+
communication on electronic mailing lists, source code control systems,
|
|
71
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
72
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
73
|
+
excluding communication that is conspicuously marked or otherwise
|
|
74
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
75
|
+
|
|
76
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
77
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
78
|
+
subsequently incorporated within the Work.
|
|
79
|
+
|
|
80
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
81
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
82
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
83
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
84
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
85
|
+
Work and such Derivative Works in Source or Object form.
|
|
86
|
+
|
|
87
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
88
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
89
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
90
|
+
(except as stated in this section) patent license to make, have made,
|
|
91
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
92
|
+
where such license applies only to those patent claims licensable
|
|
93
|
+
by such Contributor that are necessarily infringed by their
|
|
94
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
95
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
96
|
+
institute patent litigation against any entity (including a
|
|
97
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
98
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
99
|
+
or contributory patent infringement, then any patent licenses
|
|
100
|
+
granted to You under this License for that Work shall terminate
|
|
101
|
+
as of the date such litigation is filed.
|
|
102
|
+
|
|
103
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
104
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
105
|
+
modifications, and in Source or Object form, provided that You
|
|
106
|
+
meet the following conditions:
|
|
107
|
+
|
|
108
|
+
(a) You must give any other recipients of the Work or
|
|
109
|
+
Derivative Works a copy of this License; and
|
|
110
|
+
|
|
111
|
+
(b) You must cause any modified files to carry prominent notices
|
|
112
|
+
stating that You changed the files; and
|
|
113
|
+
|
|
114
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
115
|
+
that You distribute, all copyright, patent, trademark, and
|
|
116
|
+
attribution notices from the Source form of the Work,
|
|
117
|
+
excluding those notices that do not pertain to any part of
|
|
118
|
+
the Derivative Works; and
|
|
119
|
+
|
|
120
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
121
|
+
distribution, then any Derivative Works that You distribute must
|
|
122
|
+
include a readable copy of the attribution notices contained
|
|
123
|
+
within such NOTICE file, excluding those notices that do not
|
|
124
|
+
pertain to any part of the Derivative Works, in at least one
|
|
125
|
+
of the following places: within a NOTICE text file distributed
|
|
126
|
+
as part of the Derivative Works; within the Source form or
|
|
127
|
+
documentation, if provided along with the Derivative Works; or,
|
|
128
|
+
within a display generated by the Derivative Works, if and
|
|
129
|
+
wherever such third-party notices normally appear. The contents
|
|
130
|
+
of the NOTICE file are for informational purposes only and
|
|
131
|
+
do not modify the License. You may add Your own attribution
|
|
132
|
+
notices within Derivative Works that You distribute, alongside
|
|
133
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
134
|
+
that such additional attribution notices cannot be construed
|
|
135
|
+
as modifying the License.
|
|
136
|
+
|
|
137
|
+
You may add Your own copyright statement to Your modifications and
|
|
138
|
+
may provide additional or different license terms and conditions
|
|
139
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
140
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
141
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
142
|
+
the conditions stated in this License.
|
|
143
|
+
|
|
144
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
145
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
146
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
147
|
+
this License, without any additional terms or conditions.
|
|
148
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
149
|
+
the terms of any separate license agreement you may have executed
|
|
150
|
+
with Licensor regarding such Contributions.
|
|
151
|
+
|
|
152
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
153
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
154
|
+
except as required for reasonable and customary use in describing the
|
|
155
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
156
|
+
|
|
157
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
158
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
159
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
160
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
161
|
+
implied, including, without limitation, any warranties or conditions
|
|
162
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
163
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
164
|
+
appropriateness of using or redistributing the Work and assume any
|
|
165
|
+
risks associated with Your exercise of permissions under this License.
|
|
166
|
+
|
|
167
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
168
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
169
|
+
unless required by applicable law (such as deliberate and grossly
|
|
170
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
171
|
+
liable to You for damages, including any direct, indirect, special,
|
|
172
|
+
incidental, or consequential damages of any character arising as a
|
|
173
|
+
result of this License or out of the use or inability to use the
|
|
174
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
175
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
176
|
+
other commercial damages or losses), even if such Contributor
|
|
177
|
+
has been advised of the possibility of such damages.
|
|
178
|
+
|
|
179
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
180
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
181
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
182
|
+
or other liability obligations and/or rights consistent with this
|
|
183
|
+
License. However, in accepting such obligations, You may act only
|
|
184
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
185
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
186
|
+
defend, and hold each Contributor harmless for any liability
|
|
187
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
188
|
+
of your accepting any such warranty or additional liability.
|
|
189
|
+
|
|
190
|
+
END OF TERMS AND CONDITIONS
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: evo-data-converters-omf
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python data converters for OMF to Evo geoscience objects
|
|
5
|
+
Author-email: Seequent <support@seequent.com>
|
|
6
|
+
Requires-Python: >=3.10
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
License-File: LICENSE.md
|
|
9
|
+
Requires-Dist: evo-data-converters-common
|
|
10
|
+
Requires-Dist: pandas
|
|
11
|
+
Requires-Dist: omf>=1.0.1
|
|
12
|
+
Requires-Dist: omf2>=0.2.0-beta.1
|
|
13
|
+
Dynamic: license-file
|
|
14
|
+
|
|
15
|
+
<p align="center"><a href="https://seequent.com" target="_blank"><picture><source media="(prefers-color-scheme: dark)" srcset="https://developer.seequent.com/img/seequent-logo-dark.svg" alt="Seequent logo" width="400" /><img src="https://developer.seequent.com/img/seequent-logo.svg" alt="Seequent logo" width="400" /></picture></a></p>
|
|
16
|
+
<p align="center">
|
|
17
|
+
<a href="https://pypi.org/project/evo-data-converters-omf/"><img alt="PyPI - Version" src="https://img.shields.io/pypi/v/evo-data-converters-omf" /></a>
|
|
18
|
+
<a href="https://github.com/SeequentEvo/evo-data-converters/actions/workflows/on-merge.yaml"><img src="https://github.com/SeequentEvo/evo-data-converters/actions/workflows/on-merge.yaml/badge.svg" alt="" /></a>
|
|
19
|
+
</p>
|
|
20
|
+
<p align="center">
|
|
21
|
+
<a href="https://developer.seequent.com/" target="_blank">Seequent Developer Portal</a>
|
|
22
|
+
• <a href="https://community.seequent.com/" target="_blank">Seequent Community</a>
|
|
23
|
+
• <a href="https://seequent.com" target="_blank">Seequent website</a>
|
|
24
|
+
</p>
|
|
25
|
+
|
|
26
|
+
## Evo
|
|
27
|
+
|
|
28
|
+
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.
|
|
29
|
+
|
|
30
|
+
Evo is powered by Seequent, a Bentley organisation.
|
|
31
|
+
|
|
32
|
+
## Pre-requisites
|
|
33
|
+
|
|
34
|
+
* Python >= 3.10, <= 3.12
|
|
35
|
+
|
|
36
|
+
## Installation
|
|
37
|
+
|
|
38
|
+
**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.
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
pip install -e "git+https://github.com/gmggroup/omf-rust.git#egg=omf2&subdirectory=omf-python"
|
|
42
|
+
|
|
43
|
+
pip install evo-data-converters
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## OMF
|
|
47
|
+
|
|
48
|
+
Open Mining Format (OMF) is a standard backed by the Global Mining Guidelines Group.
|
|
49
|
+
|
|
50
|
+
Refer here for more information: https://omf.readthedocs.io/en/latest/
|
|
51
|
+
|
|
52
|
+
To work with OMF files the `omf2` module is used, which is a Python interface to the `omf_rust` package:
|
|
53
|
+
|
|
54
|
+
https://github.com/gmggroup/omf-rust
|
|
55
|
+
|
|
56
|
+
### Publish geoscience objects from an OMF file
|
|
57
|
+
**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.
|
|
58
|
+
|
|
59
|
+
[The `evo-sdk-common` Python library](https://pypi.org/project/evo-sdk-common/) 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`](https://pypi.org/project/evo-objects/) to get an `ObjectAPIClient`, and [`evo-data-converters-common`](https://pypi.org/project/evo-data-converters-common/) to convert your file.
|
|
60
|
+
|
|
61
|
+
Choose the OMF file you want to publish and set its path in the `omf_file` variable.
|
|
62
|
+
Choose an EPSG code to use for the Coordinate Reference System.
|
|
63
|
+
|
|
64
|
+
You can also specify tags to add to the created geoscience objects.
|
|
65
|
+
|
|
66
|
+
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.
|
|
67
|
+
|
|
68
|
+
**Note:** Some geometry types are not yet supported. A warning will be shown for each element that could not be converted.
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
import os
|
|
72
|
+
import pprint
|
|
73
|
+
|
|
74
|
+
from evo.aio import AioTransport
|
|
75
|
+
from evo.common import APIConnector
|
|
76
|
+
from evo.common.utils import BackoffIncremental
|
|
77
|
+
from evo.data_converters.omf.importer import convert_omf
|
|
78
|
+
from evo.discovery import DiscoveryAPIClient
|
|
79
|
+
from evo.oauth import AuthorizationCodeAuthorizer, OIDCConnector
|
|
80
|
+
from evo.objects import ObjectAPIClient
|
|
81
|
+
from evo.workspaces import WorkspaceAPIClient
|
|
82
|
+
|
|
83
|
+
# Configure the transport.
|
|
84
|
+
transport = AioTransport(
|
|
85
|
+
user_agent="evo-sdk-common-example",
|
|
86
|
+
max_attempts=3,
|
|
87
|
+
backoff_method=BackoffIncremental(2),
|
|
88
|
+
num_pools=4,
|
|
89
|
+
verify_ssl=True,
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
# Login to the Evo platform.
|
|
93
|
+
# User Login
|
|
94
|
+
authorizer = AuthorizationCodeAuthorizer(
|
|
95
|
+
redirect_url="<redirect_url>",
|
|
96
|
+
oidc_connector=OIDCConnector(
|
|
97
|
+
transport=transport,
|
|
98
|
+
oidc_issuer="<issuer_url>",
|
|
99
|
+
client_id="<client_id>",
|
|
100
|
+
),
|
|
101
|
+
)
|
|
102
|
+
await authorizer.login()
|
|
103
|
+
|
|
104
|
+
# Select an Organization.
|
|
105
|
+
async with APIConnector("https://discover.api.seequent.com", transport, authorizer) as api_connector:
|
|
106
|
+
discovery_client = DiscoveryAPIClient(api_connector)
|
|
107
|
+
organizations = await discovery_client.list_organizations()
|
|
108
|
+
|
|
109
|
+
selected_org = organizations[0]
|
|
110
|
+
|
|
111
|
+
# Select a hub and create a connector.
|
|
112
|
+
hub_connector = APIConnector(selected_org.hubs[0].url, transport, authorizer)
|
|
113
|
+
|
|
114
|
+
# Select a Workspace.
|
|
115
|
+
async with hub_connector:
|
|
116
|
+
workspace_client = WorkspaceAPIClient(hub_connector, selected_org.id)
|
|
117
|
+
workspaces = await workspace_client.list_workspaces()
|
|
118
|
+
|
|
119
|
+
workspace = workspaces[0]
|
|
120
|
+
workspace_env = workspace.get_environment()
|
|
121
|
+
|
|
122
|
+
# Convert your object.
|
|
123
|
+
async with hub_connector:
|
|
124
|
+
service_client = ObjectAPIClient(workspace_env, hub_connector)
|
|
125
|
+
omf_file = os.path.join(os.getcwd(), "data/input/one_of_everything.omf")
|
|
126
|
+
epsg_code = 32650
|
|
127
|
+
|
|
128
|
+
tags = {"TagName": "Tag value"}
|
|
129
|
+
|
|
130
|
+
objects_metadata = convert_omf(
|
|
131
|
+
filepath=omf_file,
|
|
132
|
+
epsg_code=epsg_code,
|
|
133
|
+
object_service_client=service_client,
|
|
134
|
+
tags=tags,
|
|
135
|
+
upload_path="path/to/my/object"
|
|
136
|
+
)
|
|
137
|
+
|
|
138
|
+
print("These objects have now been published:")
|
|
139
|
+
for metadata in objects_metadata:
|
|
140
|
+
pprint.pp(metadata, indent=4)
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Export objects to OMF
|
|
144
|
+
|
|
145
|
+
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()`.
|
|
146
|
+
See documentation on the `ObjectAPIClient` for listing objects and getting their IDs and versions.
|
|
147
|
+
|
|
148
|
+
You may also specify the version of this object to export. If not specified, so it will export the latest version.
|
|
149
|
+
|
|
150
|
+
You will need the same selection of organisation, Evo hub, and workspace that is needed for importing objects.
|
|
151
|
+
|
|
152
|
+
**Note**: Some geoscience object types are not yet supported.
|
|
153
|
+
|
|
154
|
+
```python
|
|
155
|
+
import os
|
|
156
|
+
from uuid import UUID
|
|
157
|
+
|
|
158
|
+
from evo.data_converters.common import EvoObjectMetadata
|
|
159
|
+
from evo.data_converters.omf.exporter import export_omf
|
|
160
|
+
|
|
161
|
+
objects = []
|
|
162
|
+
objects.append(
|
|
163
|
+
EvoObjectMetadata(
|
|
164
|
+
object_id=UUID("<object_id>"),
|
|
165
|
+
version_id="<version_id>"))
|
|
166
|
+
|
|
167
|
+
output_dir = "data/output"
|
|
168
|
+
os.makedirs(output_dir, exist_ok=True)
|
|
169
|
+
|
|
170
|
+
output_file = f"{output_dir}/object.omf"
|
|
171
|
+
|
|
172
|
+
export_omf(
|
|
173
|
+
filepath=output_file,
|
|
174
|
+
objects=objects,
|
|
175
|
+
service_client=service_client,
|
|
176
|
+
)
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### Block models
|
|
180
|
+
|
|
181
|
+
[Block models](https://developer.seequent.com/docs/guides/blockmodel) can be imported using the standard `convert_omf` function.
|
|
182
|
+
|
|
183
|
+
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`.
|
|
184
|
+
|
|
185
|
+
```python
|
|
186
|
+
from evo.data_converters.common import BlockSyncClient
|
|
187
|
+
|
|
188
|
+
blocksync_client = BlockSyncClient(workspace_env, hub_connector)
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
#### Export a block model to OMF V1
|
|
192
|
+
|
|
193
|
+
Specify the block model UUID of the block model object you want to export and the output file path, then call `export_blocksync_omf()`.
|
|
194
|
+
|
|
195
|
+
**Note**: At this stage only Regular block model types are supported.
|
|
196
|
+
|
|
197
|
+
```python
|
|
198
|
+
import os
|
|
199
|
+
from uuid import UUID
|
|
200
|
+
|
|
201
|
+
from evo.data_converters.omf.exporter import export_blocksync_omf
|
|
202
|
+
|
|
203
|
+
object_id = ""
|
|
204
|
+
version_id = None
|
|
205
|
+
|
|
206
|
+
output_dir = "data/output"
|
|
207
|
+
os.makedirs(output_dir, exist_ok=True)
|
|
208
|
+
|
|
209
|
+
output_file = f"{output_dir}/{object_id}.omf"
|
|
210
|
+
|
|
211
|
+
export_blocksync_omf(
|
|
212
|
+
filepath=output_file,
|
|
213
|
+
object_id=UUID(object_id),
|
|
214
|
+
version_id=version_id,
|
|
215
|
+
service_client=blocksync_client,
|
|
216
|
+
)
|
|
217
|
+
|
|
218
|
+
print(f"File saved to {output_file}")
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### Download Parquet file only
|
|
222
|
+
|
|
223
|
+
```python
|
|
224
|
+
import shutil
|
|
225
|
+
|
|
226
|
+
import pyarrow.parquet as pq
|
|
227
|
+
|
|
228
|
+
object_id = ""
|
|
229
|
+
dest_file = f"data/output/{object_id}.parquet"
|
|
230
|
+
|
|
231
|
+
job_url = blocksync_client.get_blockmodel_columns_job_url(object_id)
|
|
232
|
+
download_url = blocksync_client.get_blockmodel_columns_download_url(job_url)
|
|
233
|
+
downloaded_file = blocksync_client.download_parquet(download_url)
|
|
234
|
+
|
|
235
|
+
shutil.copy(downloaded_file.name, dest_file)
|
|
236
|
+
|
|
237
|
+
table = pq.read_table(dest_file)
|
|
238
|
+
|
|
239
|
+
for column in table.column_names:
|
|
240
|
+
print(f"{column} is of type: {table.schema.field(column).type}")
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
## Code of conduct
|
|
244
|
+
|
|
245
|
+
We rely on an open, friendly, inclusive environment. To help us ensure this remains possible, please familiarise yourself with our [code of conduct.](https://github.com/SeequentEvo/evo-data-converters/blob/main/CODE_OF_CONDUCT.md)
|
|
246
|
+
|
|
247
|
+
## License
|
|
248
|
+
Evo data converters are open source and licensed under the [Apache 2.0 license.](./LICENSE.md)
|
|
249
|
+
|
|
250
|
+
Copyright © 2025 Bentley Systems, Incorporated.
|
|
251
|
+
|
|
252
|
+
Licensed under the Apache License, Version 2.0 (the "License").
|
|
253
|
+
You may obtain a copy of the License at
|
|
254
|
+
|
|
255
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
256
|
+
|
|
257
|
+
Unless required by applicable law or agreed to in writing, software
|
|
258
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
259
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
260
|
+
See the License for the specific language governing permissions and
|
|
261
|
+
limitations under the License.
|