evo-data-converters-image 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_image-0.1.0/.gitignore +140 -0
- evo_data_converters_image-0.1.0/LICENSE.md +190 -0
- evo_data_converters_image-0.1.0/PKG-INFO +71 -0
- evo_data_converters_image-0.1.0/pyproject.toml +60 -0
- evo_data_converters_image-0.1.0/src/evo/data_converters/image/__init__.py +14 -0
- evo_data_converters_image-0.1.0/src/evo/data_converters/image/image_to_grid.py +372 -0
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.pyc
|
|
6
|
+
|
|
7
|
+
# C extensions
|
|
8
|
+
*.so
|
|
9
|
+
|
|
10
|
+
# Distribution / packaging
|
|
11
|
+
.Python
|
|
12
|
+
build/
|
|
13
|
+
develop-eggs/
|
|
14
|
+
dist/
|
|
15
|
+
downloads/
|
|
16
|
+
eggs/
|
|
17
|
+
.eggs/
|
|
18
|
+
lib/
|
|
19
|
+
lib64/
|
|
20
|
+
parts/
|
|
21
|
+
sdist/
|
|
22
|
+
var/
|
|
23
|
+
wheels/
|
|
24
|
+
pip-wheel-metadata/
|
|
25
|
+
share/python-wheels/
|
|
26
|
+
*.egg-info/
|
|
27
|
+
.installed.cfg
|
|
28
|
+
*.egg
|
|
29
|
+
MANIFEST
|
|
30
|
+
|
|
31
|
+
# PyInstaller
|
|
32
|
+
# Usually these files are written by a python script from a template
|
|
33
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
34
|
+
*.manifest
|
|
35
|
+
*.spec
|
|
36
|
+
|
|
37
|
+
# Installer logs
|
|
38
|
+
pip-log.txt
|
|
39
|
+
pip-delete-this-directory.txt
|
|
40
|
+
|
|
41
|
+
# Unit test / coverage reports
|
|
42
|
+
htmlcov/
|
|
43
|
+
.tox/
|
|
44
|
+
.nox/
|
|
45
|
+
.coverage
|
|
46
|
+
.coverage.*
|
|
47
|
+
.cache
|
|
48
|
+
nosetests.xml
|
|
49
|
+
coverage.xml
|
|
50
|
+
*.cover
|
|
51
|
+
*.py,cover
|
|
52
|
+
.hypothesis/
|
|
53
|
+
.pytest_cache/
|
|
54
|
+
|
|
55
|
+
# Translations
|
|
56
|
+
*.mo
|
|
57
|
+
*.pot
|
|
58
|
+
|
|
59
|
+
# Django stuff:
|
|
60
|
+
*.log
|
|
61
|
+
local_settings.py
|
|
62
|
+
db.sqlite3
|
|
63
|
+
db.sqlite3-journal
|
|
64
|
+
|
|
65
|
+
# Flask stuff:
|
|
66
|
+
instance/
|
|
67
|
+
.webassets-cache
|
|
68
|
+
|
|
69
|
+
# Scrapy stuff:
|
|
70
|
+
.scrapy
|
|
71
|
+
|
|
72
|
+
# Sphinx documentation
|
|
73
|
+
docs/_build/
|
|
74
|
+
|
|
75
|
+
# PyBuilder
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pipenv
|
|
86
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
87
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
88
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
89
|
+
# install all needed dependencies.
|
|
90
|
+
#Pipfile.lock
|
|
91
|
+
|
|
92
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
|
93
|
+
__pypackages__/
|
|
94
|
+
|
|
95
|
+
# Celery stuff
|
|
96
|
+
celerybeat-schedule
|
|
97
|
+
celerybeat.pid
|
|
98
|
+
|
|
99
|
+
# SageMath parsed files
|
|
100
|
+
*.sage.py
|
|
101
|
+
|
|
102
|
+
# Environments
|
|
103
|
+
.env
|
|
104
|
+
.venv
|
|
105
|
+
example_virtual_env
|
|
106
|
+
env/
|
|
107
|
+
venv/
|
|
108
|
+
ENV/
|
|
109
|
+
env.bak/
|
|
110
|
+
venv.bak/
|
|
111
|
+
|
|
112
|
+
# Spyder project settings
|
|
113
|
+
.spyderproject
|
|
114
|
+
.spyproject
|
|
115
|
+
|
|
116
|
+
# Rope project settings
|
|
117
|
+
.ropeproject
|
|
118
|
+
|
|
119
|
+
# mkdocs documentation
|
|
120
|
+
/site
|
|
121
|
+
|
|
122
|
+
# mypy
|
|
123
|
+
.mypy_cache/
|
|
124
|
+
.dmypy.json
|
|
125
|
+
dmypy.json
|
|
126
|
+
|
|
127
|
+
# Pyre type checker
|
|
128
|
+
.pyre/
|
|
129
|
+
|
|
130
|
+
# Custom
|
|
131
|
+
.idea
|
|
132
|
+
query_results.parquet
|
|
133
|
+
.cache_ggshield
|
|
134
|
+
|
|
135
|
+
# Object data client caches
|
|
136
|
+
samples/data-converters/python/convert-omf/data/cache
|
|
137
|
+
data/cache
|
|
138
|
+
|
|
139
|
+
# Development tools
|
|
140
|
+
.vscode/
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
Copyright © 2026 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,71 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: evo-data-converters-image
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Image data converter for EVO (supports JPEG, PNG, TIFF, etc.)
|
|
5
|
+
Project-URL: Source, https://github.com/SeequentEvo/evo-data-converters
|
|
6
|
+
Project-URL: Tracker, https://github.com/SeequentEvo/evo-data-converters/issues
|
|
7
|
+
Project-URL: Homepage, https://www.seequent.com/
|
|
8
|
+
Project-URL: Documentation, https://developer.seequent.com/
|
|
9
|
+
Author-email: Seequent <support@seequent.com>
|
|
10
|
+
License-File: LICENSE.md
|
|
11
|
+
Requires-Python: >=3.10
|
|
12
|
+
Requires-Dist: evo-data-converters-common>=0.3.1
|
|
13
|
+
Requires-Dist: evo-objects>=0.3.3
|
|
14
|
+
Requires-Dist: evo-schemas>=2025.12.15
|
|
15
|
+
Requires-Dist: evo-sdk-common>=0.5.12
|
|
16
|
+
Requires-Dist: numpy<=1.26.4
|
|
17
|
+
Requires-Dist: pillow
|
|
18
|
+
Requires-Dist: pyarrow
|
|
19
|
+
Requires-Dist: pydantic
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
|
|
22
|
+
<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>
|
|
23
|
+
<p align="center">
|
|
24
|
+
<a href="https://pypi.org/project/evo-data-converters-image/"><img alt="PyPI - Version" src="https://img.shields.io/pypi/v/evo-data-converters-image" /></a>
|
|
25
|
+
<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>
|
|
26
|
+
</p>
|
|
27
|
+
<p align="center">
|
|
28
|
+
<a href="https://developer.seequent.com/" target="_blank">Seequent Developer Portal</a>
|
|
29
|
+
• <a href="https://community.seequent.com/group/19-evo" target="_blank">Seequent Community</a>
|
|
30
|
+
• <a href="https://seequent.com" target="_blank">Seequent website</a>
|
|
31
|
+
</p>
|
|
32
|
+
|
|
33
|
+
## Evo
|
|
34
|
+
|
|
35
|
+
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.
|
|
36
|
+
|
|
37
|
+
Evo is powered by Seequent, a Bentley organisation.
|
|
38
|
+
|
|
39
|
+
## Pre-requisites
|
|
40
|
+
|
|
41
|
+
* Python 3.10, 3.11, or 3.12
|
|
42
|
+
|
|
43
|
+
## Installation
|
|
44
|
+
|
|
45
|
+
```shell
|
|
46
|
+
pip install evo-data-converters-image
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Image Converter
|
|
50
|
+
|
|
51
|
+
This package provides a converter for image files (JPEG, PNG, TIFF, BMP, GIF, etc.) to Regular 2D Grid geoscience objects.
|
|
52
|
+
|
|
53
|
+
## Code of conduct
|
|
54
|
+
|
|
55
|
+
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)
|
|
56
|
+
|
|
57
|
+
## License
|
|
58
|
+
Evo data converters are open source and licensed under the [Apache 2.0 license.](https://github.com/SeequentEvo/evo-data-converters/tree/main/packages/image/./LICENSE.md)
|
|
59
|
+
|
|
60
|
+
Copyright © 2026 Bentley Systems, Incorporated.
|
|
61
|
+
|
|
62
|
+
Licensed under the Apache License, Version 2.0 (the "License").
|
|
63
|
+
You may obtain a copy of the License at
|
|
64
|
+
|
|
65
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
66
|
+
|
|
67
|
+
Unless required by applicable law or agreed to in writing, software
|
|
68
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
69
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
70
|
+
See the License for the specific language governing permissions and
|
|
71
|
+
limitations under the License.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "evo-data-converters-image"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Image data converter for EVO (supports JPEG, PNG, TIFF, etc.)"
|
|
5
|
+
license-files = ["LICENSE.md"]
|
|
6
|
+
dynamic = ["readme"]
|
|
7
|
+
requires-python = ">=3.10"
|
|
8
|
+
authors = [
|
|
9
|
+
{ name = "Seequent", email = "support@seequent.com" }
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
dependencies = [
|
|
14
|
+
"evo-data-converters-common>=0.3.1",
|
|
15
|
+
"evo-objects>=0.3.3",
|
|
16
|
+
"evo-schemas>=2025.12.15",
|
|
17
|
+
"evo-sdk-common>=0.5.12",
|
|
18
|
+
"numpy<=1.26.4",
|
|
19
|
+
"pyarrow",
|
|
20
|
+
"pydantic",
|
|
21
|
+
"pillow",
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
[project.urls]
|
|
25
|
+
Source = "https://github.com/SeequentEvo/evo-data-converters"
|
|
26
|
+
Tracker = "https://github.com/SeequentEvo/evo-data-converters/issues"
|
|
27
|
+
Homepage = "https://www.seequent.com/"
|
|
28
|
+
Documentation = "https://developer.seequent.com/"
|
|
29
|
+
|
|
30
|
+
[dependency-groups]
|
|
31
|
+
dev = [
|
|
32
|
+
"pytest",
|
|
33
|
+
"requests-mock",
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
[tool.ruff]
|
|
37
|
+
src = ["src", "tests"]
|
|
38
|
+
line-length = 120
|
|
39
|
+
|
|
40
|
+
[build-system]
|
|
41
|
+
requires = ["hatchling", "hatch-fancy-pypi-readme"]
|
|
42
|
+
build-backend = "hatchling.build"
|
|
43
|
+
|
|
44
|
+
[tool.hatch.build.targets.sdist]
|
|
45
|
+
include = ["src"]
|
|
46
|
+
|
|
47
|
+
[tool.hatch.build.targets.wheel]
|
|
48
|
+
packages = ["src/evo"]
|
|
49
|
+
|
|
50
|
+
[tool.hatch.metadata.hooks.fancy-pypi-readme]
|
|
51
|
+
content-type = "text/markdown"
|
|
52
|
+
|
|
53
|
+
[[tool.hatch.metadata.hooks.fancy-pypi-readme.fragments]]
|
|
54
|
+
path = "README.md"
|
|
55
|
+
|
|
56
|
+
[[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]]
|
|
57
|
+
# Literal TOML strings (single quotes) need no escaping of backslashes.
|
|
58
|
+
# Converts relative links to absolute links in PyPI
|
|
59
|
+
pattern = '\[(.+?)\]\(((?!https?://)\S+?)\)'
|
|
60
|
+
replacement = '[\1](https://github.com/SeequentEvo/evo-data-converters/tree/main/packages/image/\g<2>)'
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Copyright © 2026 Bentley Systems, Incorporated
|
|
2
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
# you may not use this file except in compliance with the License.
|
|
4
|
+
# You may obtain a copy of the License at
|
|
5
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
7
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
8
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
9
|
+
# See the License for the specific language governing permissions and
|
|
10
|
+
# limitations under the License.
|
|
11
|
+
|
|
12
|
+
from evo.data_converters.image.image_to_grid import convert_image_to_grid
|
|
13
|
+
|
|
14
|
+
__all__ = ["convert_image_to_grid"]
|
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
# Copyright © 2026 Bentley Systems, Incorporated
|
|
2
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
# you may not use this file except in compliance with the License.
|
|
4
|
+
# You may obtain a copy of the License at
|
|
5
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
7
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
8
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
9
|
+
# See the License for the specific language governing permissions and
|
|
10
|
+
# limitations under the License.
|
|
11
|
+
|
|
12
|
+
"""
|
|
13
|
+
Image to Regular 2D Grid Converter
|
|
14
|
+
|
|
15
|
+
This module converts images (JPEG, PNG, TIFF, etc.) into Geoscience Objects following the
|
|
16
|
+
regular-2d-grid schema. It reads pixel values from image files and creates properly formatted
|
|
17
|
+
JSON with associated parquet data files.
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
from __future__ import annotations
|
|
21
|
+
|
|
22
|
+
import io
|
|
23
|
+
import hashlib
|
|
24
|
+
from pathlib import Path
|
|
25
|
+
from typing import Optional, TYPE_CHECKING
|
|
26
|
+
|
|
27
|
+
import numpy as np
|
|
28
|
+
from PIL import Image
|
|
29
|
+
|
|
30
|
+
import pyarrow as pa
|
|
31
|
+
import pyarrow.parquet as pq
|
|
32
|
+
|
|
33
|
+
import evo.logging
|
|
34
|
+
from evo.data_converters.common import (
|
|
35
|
+
EvoWorkspaceMetadata,
|
|
36
|
+
create_evo_object_service_and_data_client,
|
|
37
|
+
publish_geoscience_objects_sync,
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
from evo.objects.utils.data import ObjectDataClient
|
|
41
|
+
from evo_schemas.objects import Regular2DGrid_V1_3_0
|
|
42
|
+
from evo_schemas.components import (
|
|
43
|
+
BoundingBox_V1_0_1,
|
|
44
|
+
Rotation_V1_1_0,
|
|
45
|
+
OneOfAttribute_V1_2_0,
|
|
46
|
+
ContinuousAttribute_V1_1_0,
|
|
47
|
+
NanContinuous_V1_0_1,
|
|
48
|
+
AttributeDescription_V1_0_1,
|
|
49
|
+
Crs_V1_0_1_EpsgCode,
|
|
50
|
+
)
|
|
51
|
+
from evo_schemas.elements import FloatArray1_V1_0_1
|
|
52
|
+
|
|
53
|
+
logger = evo.logging.getLogger("data_converters")
|
|
54
|
+
|
|
55
|
+
if TYPE_CHECKING:
|
|
56
|
+
from evo.notebooks import ServiceManagerWidget
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
# -----------------------------------------------------------------------------
|
|
60
|
+
# Parquet writer options recommended by geoscience object schemas
|
|
61
|
+
# -----------------------------------------------------------------------------
|
|
62
|
+
def geoscience_object_data_options() -> dict:
|
|
63
|
+
"""Enforce required options for writing Parquet files for geoscience object schemas."""
|
|
64
|
+
return {
|
|
65
|
+
"version": "2.4",
|
|
66
|
+
"flavor": None,
|
|
67
|
+
"data_page_size": None,
|
|
68
|
+
"compression": "gzip",
|
|
69
|
+
"encryption_properties": None,
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
# -----------------------------------------------------------------------------
|
|
74
|
+
# Local stub data client for offline runs (no Evo credentials required)
|
|
75
|
+
# -----------------------------------------------------------------------------
|
|
76
|
+
class _LocalObjectDataClientStub:
|
|
77
|
+
"""
|
|
78
|
+
Minimal stand-in for ObjectDataClient when running offline.
|
|
79
|
+
- Writes the provided Arrow table to ./parquet_arrays/<sha256>.parquet
|
|
80
|
+
- Returns a dict with keys that mirror the real client's save_table result.
|
|
81
|
+
"""
|
|
82
|
+
|
|
83
|
+
def __init__(self, output_dir: str = "./parquet_arrays"):
|
|
84
|
+
self.output_path = Path(output_dir)
|
|
85
|
+
self.output_path.mkdir(parents=True, exist_ok=True)
|
|
86
|
+
|
|
87
|
+
def save_table(self, table: pa.Table):
|
|
88
|
+
# Serialize to memory to compute a stable content hash
|
|
89
|
+
buf = io.BytesIO()
|
|
90
|
+
pq.write_table(table, buf, **geoscience_object_data_options())
|
|
91
|
+
data = buf.getvalue()
|
|
92
|
+
data_hash = hashlib.sha256(data).hexdigest()
|
|
93
|
+
|
|
94
|
+
# Persist a local copy so you can inspect/debug the parquet
|
|
95
|
+
(self.output_path / f"{data_hash}.parquet").write_bytes(data)
|
|
96
|
+
|
|
97
|
+
# Shape matches what the converter expects from the real data client
|
|
98
|
+
# (include basic metadata commonly used by downstream code)
|
|
99
|
+
return {
|
|
100
|
+
"data": data_hash,
|
|
101
|
+
"length": table.num_rows,
|
|
102
|
+
"width": 1,
|
|
103
|
+
"data_type": "float64",
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
# -----------------------------------------------------------------------------
|
|
108
|
+
# Core converter implementation
|
|
109
|
+
# -----------------------------------------------------------------------------
|
|
110
|
+
class ImageGridConverter:
|
|
111
|
+
"""Converts images (JPEG, PNG, TIFF, etc.) to Regular 2D Grid format."""
|
|
112
|
+
|
|
113
|
+
def __init__(
|
|
114
|
+
self,
|
|
115
|
+
data_client: ObjectDataClient | _LocalObjectDataClientStub | None,
|
|
116
|
+
output_dir: str = "./parquet_arrays",
|
|
117
|
+
output_parquet: bool = False,
|
|
118
|
+
):
|
|
119
|
+
"""Initialize the Image to Grid converter.
|
|
120
|
+
|
|
121
|
+
:param data_client: Object data client for uploading parquet files (real or stub). If None, the
|
|
122
|
+
converter will still compute a content hash and optionally write a local parquet
|
|
123
|
+
when output_parquet=True.
|
|
124
|
+
:param output_dir: Directory to store parquet files
|
|
125
|
+
:param output_parquet: Whether to write parquet files to disk (for debugging)
|
|
126
|
+
"""
|
|
127
|
+
self.data_client = data_client
|
|
128
|
+
self.output_dir = output_dir
|
|
129
|
+
self.output_path = Path(output_dir)
|
|
130
|
+
self.output_parquet = output_parquet
|
|
131
|
+
|
|
132
|
+
def _read_image_as_grayscale(self, image_path: str) -> tuple[np.ndarray, int, int]:
|
|
133
|
+
"""Read image file and convert to grayscale values.
|
|
134
|
+
|
|
135
|
+
Supports JPEG, PNG, TIFF, BMP, GIF, and other formats supported by PIL/Pillow.
|
|
136
|
+
|
|
137
|
+
:param image_path: Path to the image file
|
|
138
|
+
:return: Tuple of (flattened pixel_values (float64), width, height)
|
|
139
|
+
"""
|
|
140
|
+
logger.info(f"Reading image file: {image_path}")
|
|
141
|
+
|
|
142
|
+
with Image.open(image_path) as img:
|
|
143
|
+
grayscale_img = img.convert("L") # luminance
|
|
144
|
+
width, height = grayscale_img.size
|
|
145
|
+
logger.info(f"Image dimensions: {width}x{height}")
|
|
146
|
+
|
|
147
|
+
# Vectorized conversion to 1D float64 (row-major)
|
|
148
|
+
cell_values = np.asarray(grayscale_img, dtype=np.float64).ravel(order="C")
|
|
149
|
+
|
|
150
|
+
return cell_values, width, height
|
|
151
|
+
|
|
152
|
+
def _create_parquet_file(self, table: pa.Table) -> tuple[str, Path | None]:
|
|
153
|
+
"""Create parquet file and return (hash, local_path_if_any).
|
|
154
|
+
|
|
155
|
+
If a data_client is present (real or stub), use it. Otherwise, compute the hash and
|
|
156
|
+
optionally write a local file only when output_parquet=True.
|
|
157
|
+
"""
|
|
158
|
+
# Prefer the provided data_client (real Evo or local stub)
|
|
159
|
+
if self.data_client is not None:
|
|
160
|
+
logger.info("Saving parquet table via data_client.save_table(...)")
|
|
161
|
+
saved_table_info = self.data_client.save_table(table)
|
|
162
|
+
data_hash = saved_table_info["data"]
|
|
163
|
+
|
|
164
|
+
local_path: Path | None = None
|
|
165
|
+
if self.output_parquet:
|
|
166
|
+
self.output_path.mkdir(parents=True, exist_ok=True)
|
|
167
|
+
local_path = self.output_path / f"{data_hash}.parquet"
|
|
168
|
+
pq.write_table(table, local_path, **geoscience_object_data_options())
|
|
169
|
+
return data_hash, local_path
|
|
170
|
+
|
|
171
|
+
# No data_client provided: compute a content hash locally
|
|
172
|
+
logger.info("No data_client provided; computing local parquet + hash")
|
|
173
|
+
buf = io.BytesIO()
|
|
174
|
+
pq.write_table(table, buf, **geoscience_object_data_options())
|
|
175
|
+
raw = buf.getvalue()
|
|
176
|
+
data_hash = hashlib.sha256(raw).hexdigest()
|
|
177
|
+
|
|
178
|
+
local_path = None
|
|
179
|
+
if self.output_parquet:
|
|
180
|
+
self.output_path.mkdir(parents=True, exist_ok=True)
|
|
181
|
+
local_path = self.output_path / f"{data_hash}.parquet"
|
|
182
|
+
local_path.write_bytes(raw)
|
|
183
|
+
return data_hash, local_path
|
|
184
|
+
|
|
185
|
+
def _create_cell_attribute(self, cell_values: np.ndarray, width: int, height: int) -> ContinuousAttribute_V1_1_0:
|
|
186
|
+
"""Create cell attribute from pixel values."""
|
|
187
|
+
logger.info("Creating cell attribute from pixel data")
|
|
188
|
+
|
|
189
|
+
# Arrow table of values
|
|
190
|
+
table = pa.table({"values": cell_values})
|
|
191
|
+
|
|
192
|
+
# Persist parquet (via data_client or locally) and get the content hash
|
|
193
|
+
data_hash, _ = self._create_parquet_file(table)
|
|
194
|
+
|
|
195
|
+
# Attribute metadata
|
|
196
|
+
attribute_description = AttributeDescription_V1_0_1(
|
|
197
|
+
discipline="Imagery",
|
|
198
|
+
type="Grayscale Intensity",
|
|
199
|
+
)
|
|
200
|
+
|
|
201
|
+
nan_description = NanContinuous_V1_0_1(values=[-1.0000000331813535e32, -1e32])
|
|
202
|
+
|
|
203
|
+
values = FloatArray1_V1_0_1(
|
|
204
|
+
data=data_hash,
|
|
205
|
+
length=width * height,
|
|
206
|
+
width=1,
|
|
207
|
+
data_type="float64",
|
|
208
|
+
)
|
|
209
|
+
|
|
210
|
+
attribute = ContinuousAttribute_V1_1_0(
|
|
211
|
+
name="2d-grid-data-continuous",
|
|
212
|
+
key=data_hash,
|
|
213
|
+
attribute_type="scalar",
|
|
214
|
+
attribute_description=attribute_description,
|
|
215
|
+
nan_description=nan_description,
|
|
216
|
+
values=values,
|
|
217
|
+
)
|
|
218
|
+
|
|
219
|
+
return attribute
|
|
220
|
+
|
|
221
|
+
def convert(
|
|
222
|
+
self,
|
|
223
|
+
image_path: str,
|
|
224
|
+
origin: Optional[list[float]] = None,
|
|
225
|
+
cell_size: Optional[list[float]] = None,
|
|
226
|
+
coordinate_reference_system: Optional[dict] = None,
|
|
227
|
+
tags: Optional[dict[str, str]] = None,
|
|
228
|
+
name: Optional[str] = None,
|
|
229
|
+
description: Optional[str] = None,
|
|
230
|
+
) -> Regular2DGrid_V1_3_0:
|
|
231
|
+
"""Convert an image file to a Regular 2D Grid object."""
|
|
232
|
+
|
|
233
|
+
# Read and preprocess image
|
|
234
|
+
cell_values, width, height = self._read_image_as_grayscale(image_path)
|
|
235
|
+
|
|
236
|
+
# Defaults
|
|
237
|
+
grid_name = name or Path(image_path).stem
|
|
238
|
+
grid_description = description or "A 2D grid from image"
|
|
239
|
+
grid_origin = origin or [0.0, 0.0, 0.0]
|
|
240
|
+
grid_cell_size = cell_size or [1.0, 1.0]
|
|
241
|
+
|
|
242
|
+
# Bounding box (from origin, grid size, and cell size)
|
|
243
|
+
bbox = BoundingBox_V1_0_1(
|
|
244
|
+
min_x=grid_origin[0],
|
|
245
|
+
min_y=grid_origin[1],
|
|
246
|
+
min_z=grid_origin[2],
|
|
247
|
+
max_x=grid_origin[0] + (width * grid_cell_size[0]),
|
|
248
|
+
max_y=grid_origin[1] + (height * grid_cell_size[1]),
|
|
249
|
+
max_z=grid_origin[2], # 2D grid, z constant
|
|
250
|
+
)
|
|
251
|
+
|
|
252
|
+
# Rotation (default none)
|
|
253
|
+
rotation = Rotation_V1_1_0(dip=0.0, dip_azimuth=0.0, pitch=0.0)
|
|
254
|
+
|
|
255
|
+
# Cell attributes (pixel data)
|
|
256
|
+
cell_attribute = self._create_cell_attribute(cell_values, width, height)
|
|
257
|
+
|
|
258
|
+
cell_attributes_list = OneOfAttribute_V1_2_0()
|
|
259
|
+
cell_attributes_list.append(cell_attribute)
|
|
260
|
+
|
|
261
|
+
# CRS
|
|
262
|
+
crs = None
|
|
263
|
+
if coordinate_reference_system:
|
|
264
|
+
if isinstance(coordinate_reference_system, dict):
|
|
265
|
+
if "epsg_code" in coordinate_reference_system:
|
|
266
|
+
crs = Crs_V1_0_1_EpsgCode(epsg_code=coordinate_reference_system["epsg_code"])
|
|
267
|
+
elif "ogc_wkt" in coordinate_reference_system:
|
|
268
|
+
crs = coordinate_reference_system["ogc_wkt"] # WKT string
|
|
269
|
+
else:
|
|
270
|
+
crs = coordinate_reference_system
|
|
271
|
+
|
|
272
|
+
# Assemble Regular 2D Grid object
|
|
273
|
+
grid = Regular2DGrid_V1_3_0(
|
|
274
|
+
name=grid_name,
|
|
275
|
+
uuid=None, # Let the system generate
|
|
276
|
+
description=grid_description,
|
|
277
|
+
tags=tags,
|
|
278
|
+
bounding_box=bbox,
|
|
279
|
+
coordinate_reference_system=crs
|
|
280
|
+
if crs is not None
|
|
281
|
+
else Crs_V1_0_1_EpsgCode(epsg_code=4326), # default WGS84
|
|
282
|
+
origin=grid_origin,
|
|
283
|
+
size=[width, height],
|
|
284
|
+
cell_size=grid_cell_size,
|
|
285
|
+
schema="/objects/regular-2d-grid/1.3.0/regular-2d-grid.schema.json",
|
|
286
|
+
rotation=rotation,
|
|
287
|
+
cell_attributes=cell_attributes_list,
|
|
288
|
+
)
|
|
289
|
+
|
|
290
|
+
logger.info(f"Successfully converted image to Regular 2D Grid: {grid.name} ({width}x{height})")
|
|
291
|
+
return grid
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
# -----------------------------------------------------------------------------
|
|
295
|
+
# Convenience function that supports both offline (no publish) and online publish
|
|
296
|
+
# -----------------------------------------------------------------------------
|
|
297
|
+
def convert_image_to_grid(
|
|
298
|
+
image_path: str,
|
|
299
|
+
origin: Optional[list[float]] = None,
|
|
300
|
+
cell_size: Optional[list[float]] = None,
|
|
301
|
+
coordinate_reference_system: Optional[dict] = None,
|
|
302
|
+
tags: Optional[dict[str, str]] = None,
|
|
303
|
+
name: Optional[str] = None,
|
|
304
|
+
description: Optional[str] = None,
|
|
305
|
+
evo_workspace_metadata: Optional[EvoWorkspaceMetadata] = None,
|
|
306
|
+
service_manager_widget: Optional["ServiceManagerWidget"] = None,
|
|
307
|
+
upload_path: str = "",
|
|
308
|
+
publish_objects: bool = True,
|
|
309
|
+
overwrite_existing_objects: bool = False,
|
|
310
|
+
) -> list:
|
|
311
|
+
"""
|
|
312
|
+
Convert an image (JPEG, PNG, TIFF, etc.) to a Regular 2D Grid Geoscience Object.
|
|
313
|
+
|
|
314
|
+
Returns:
|
|
315
|
+
- If publish_objects=True: list[ObjectMetadata]
|
|
316
|
+
- If publish_objects=False: list[Regular2DGrid]
|
|
317
|
+
|
|
318
|
+
One of evo_workspace_metadata or service_manager_widget is required for publishing.
|
|
319
|
+
"""
|
|
320
|
+
|
|
321
|
+
# Choose data client per mode
|
|
322
|
+
if publish_objects:
|
|
323
|
+
# Online path: real Evo clients (requires credentials)
|
|
324
|
+
object_service_client, data_client = create_evo_object_service_and_data_client(
|
|
325
|
+
evo_workspace_metadata=evo_workspace_metadata,
|
|
326
|
+
service_manager_widget=service_manager_widget,
|
|
327
|
+
)
|
|
328
|
+
else:
|
|
329
|
+
# Offline path: local stub (no credentials); still writes a local parquet and computes hash
|
|
330
|
+
object_service_client = None
|
|
331
|
+
data_client = _LocalObjectDataClientStub(output_dir="./parquet_arrays")
|
|
332
|
+
|
|
333
|
+
# Convert (this will write parquet via data_client: real or stub)
|
|
334
|
+
converter = ImageGridConverter(data_client, output_parquet=False)
|
|
335
|
+
grid_object = converter.convert(
|
|
336
|
+
image_path=image_path,
|
|
337
|
+
origin=origin,
|
|
338
|
+
cell_size=cell_size,
|
|
339
|
+
coordinate_reference_system=coordinate_reference_system,
|
|
340
|
+
tags=tags,
|
|
341
|
+
name=name,
|
|
342
|
+
description=description,
|
|
343
|
+
)
|
|
344
|
+
|
|
345
|
+
geoscience_objects = [grid_object]
|
|
346
|
+
|
|
347
|
+
if publish_objects:
|
|
348
|
+
logger.debug("Publishing Geoscience Objects")
|
|
349
|
+
|
|
350
|
+
# Remove 'uuid' if None (your original behavior) before publishing
|
|
351
|
+
for obj in geoscience_objects:
|
|
352
|
+
original_as_dict = obj.as_dict
|
|
353
|
+
|
|
354
|
+
def as_dict_remove_none_uuid(orig_method=original_as_dict, obj_ref=obj):
|
|
355
|
+
d = orig_method()
|
|
356
|
+
if getattr(obj_ref, "uuid", None) is None and "uuid" in d:
|
|
357
|
+
d.pop("uuid")
|
|
358
|
+
return d
|
|
359
|
+
|
|
360
|
+
obj.as_dict = as_dict_remove_none_uuid
|
|
361
|
+
|
|
362
|
+
objects_metadata = publish_geoscience_objects_sync(
|
|
363
|
+
geoscience_objects,
|
|
364
|
+
object_service_client,
|
|
365
|
+
data_client,
|
|
366
|
+
upload_path,
|
|
367
|
+
overwrite_existing_objects,
|
|
368
|
+
)
|
|
369
|
+
return objects_metadata
|
|
370
|
+
|
|
371
|
+
# Offline: return objects for inspection
|
|
372
|
+
return geoscience_objects
|