evo-objects 0.4.1__tar.gz → 0.4.2__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_objects-0.4.1 → evo_objects-0.4.2}/PKG-INFO +1 -1
- {evo_objects-0.4.1 → evo_objects-0.4.2}/pyproject.toml +1 -1
- {evo_objects-0.4.1 → evo_objects-0.4.2}/src/evo/objects/utils/data.py +30 -6
- {evo_objects-0.4.1 → evo_objects-0.4.2}/src/evo/objects/utils/tables.py +2 -2
- {evo_objects-0.4.1 → evo_objects-0.4.2}/.gitignore +0 -0
- {evo_objects-0.4.1 → evo_objects-0.4.2}/LICENSE.md +0 -0
- {evo_objects-0.4.1 → evo_objects-0.4.2}/src/evo/objects/__init__.py +0 -0
- {evo_objects-0.4.1 → evo_objects-0.4.2}/src/evo/objects/_model_config.py +0 -0
- {evo_objects-0.4.1 → evo_objects-0.4.2}/src/evo/objects/client/__init__.py +0 -0
- {evo_objects-0.4.1 → evo_objects-0.4.2}/src/evo/objects/client/api_client.py +0 -0
- {evo_objects-0.4.1 → evo_objects-0.4.2}/src/evo/objects/client/object_client.py +0 -0
- {evo_objects-0.4.1 → evo_objects-0.4.2}/src/evo/objects/client/parse.py +0 -0
- {evo_objects-0.4.1 → evo_objects-0.4.2}/src/evo/objects/data.py +0 -0
- {evo_objects-0.4.1 → evo_objects-0.4.2}/src/evo/objects/endpoints/__init__.py +0 -0
- {evo_objects-0.4.1 → evo_objects-0.4.2}/src/evo/objects/endpoints/api/__init__.py +0 -0
- {evo_objects-0.4.1 → evo_objects-0.4.2}/src/evo/objects/endpoints/api/data_api.py +0 -0
- {evo_objects-0.4.1 → evo_objects-0.4.2}/src/evo/objects/endpoints/api/metadata_api.py +0 -0
- {evo_objects-0.4.1 → evo_objects-0.4.2}/src/evo/objects/endpoints/api/objects_api.py +0 -0
- {evo_objects-0.4.1 → evo_objects-0.4.2}/src/evo/objects/endpoints/api/stages_api.py +0 -0
- {evo_objects-0.4.1 → evo_objects-0.4.2}/src/evo/objects/endpoints/models.py +0 -0
- {evo_objects-0.4.1 → evo_objects-0.4.2}/src/evo/objects/exceptions.py +0 -0
- {evo_objects-0.4.1 → evo_objects-0.4.2}/src/evo/objects/io.py +0 -0
- {evo_objects-0.4.1 → evo_objects-0.4.2}/src/evo/objects/parquet/__init__.py +0 -0
- {evo_objects-0.4.1 → evo_objects-0.4.2}/src/evo/objects/parquet/loader.py +0 -0
- {evo_objects-0.4.1 → evo_objects-0.4.2}/src/evo/objects/py.typed +0 -0
- {evo_objects-0.4.1 → evo_objects-0.4.2}/src/evo/objects/typed/__init__.py +0 -0
- {evo_objects-0.4.1 → evo_objects-0.4.2}/src/evo/objects/typed/_data.py +0 -0
- {evo_objects-0.4.1 → evo_objects-0.4.2}/src/evo/objects/typed/_grid.py +0 -0
- {evo_objects-0.4.1 → evo_objects-0.4.2}/src/evo/objects/typed/_model.py +0 -0
- {evo_objects-0.4.1 → evo_objects-0.4.2}/src/evo/objects/typed/_utils.py +0 -0
- {evo_objects-0.4.1 → evo_objects-0.4.2}/src/evo/objects/typed/attributes.py +0 -0
- {evo_objects-0.4.1 → evo_objects-0.4.2}/src/evo/objects/typed/base.py +0 -0
- {evo_objects-0.4.1 → evo_objects-0.4.2}/src/evo/objects/typed/block_model_ref.py +0 -0
- {evo_objects-0.4.1 → evo_objects-0.4.2}/src/evo/objects/typed/exceptions.py +0 -0
- {evo_objects-0.4.1 → evo_objects-0.4.2}/src/evo/objects/typed/pointset.py +0 -0
- {evo_objects-0.4.1 → evo_objects-0.4.2}/src/evo/objects/typed/regular_grid.py +0 -0
- {evo_objects-0.4.1 → evo_objects-0.4.2}/src/evo/objects/typed/regular_masked_grid.py +0 -0
- {evo_objects-0.4.1 → evo_objects-0.4.2}/src/evo/objects/typed/spatial.py +0 -0
- {evo_objects-0.4.1 → evo_objects-0.4.2}/src/evo/objects/typed/tensor_grid.py +0 -0
- {evo_objects-0.4.1 → evo_objects-0.4.2}/src/evo/objects/typed/types.py +0 -0
- {evo_objects-0.4.1 → evo_objects-0.4.2}/src/evo/objects/typed/variogram.py +0 -0
- {evo_objects-0.4.1 → evo_objects-0.4.2}/src/evo/objects/utils/__init__.py +0 -0
- {evo_objects-0.4.1 → evo_objects-0.4.2}/src/evo/objects/utils/table_formats.py +0 -0
- {evo_objects-0.4.1 → evo_objects-0.4.2}/src/evo/objects/utils/types.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: evo-objects
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.2
|
|
4
4
|
Summary: Python SDK for using the Seequent Evo Geoscience Object API
|
|
5
5
|
Project-URL: Source, https://github.com/SeequentEvo/evo-python-sdk
|
|
6
6
|
Project-URL: Tracker, https://github.com/SeequentEvo/evo-python-sdk/issues
|
|
@@ -67,6 +67,26 @@ def _iter_refs(target: Any, _key: str | None = None) -> Iterator[str]:
|
|
|
67
67
|
yield str(value)
|
|
68
68
|
|
|
69
69
|
|
|
70
|
+
def _get_schema_from_dataframe(dataframe: "pd.DataFrame") -> pa.Schema:
|
|
71
|
+
"""Get a normalized pyarrow schema from a pandas dataframe.
|
|
72
|
+
|
|
73
|
+
This hook centralizes dataframe-to-Arrow schema adjustments before the
|
|
74
|
+
dataframe is converted to a table. It currently performs these conversions:
|
|
75
|
+
- large_string -> string
|
|
76
|
+
|
|
77
|
+
:param dataframe: The pandas dataframe to get the schema from.
|
|
78
|
+
:return: A pyarrow schema with any configured type conversions applied.
|
|
79
|
+
"""
|
|
80
|
+
schema = pa.Schema.from_pandas(dataframe)
|
|
81
|
+
fields = []
|
|
82
|
+
for field in schema:
|
|
83
|
+
if pa.types.is_large_string(field.type):
|
|
84
|
+
fields.append(field.with_type(pa.string()))
|
|
85
|
+
else:
|
|
86
|
+
fields.append(field)
|
|
87
|
+
return pa.schema(fields)
|
|
88
|
+
|
|
89
|
+
|
|
70
90
|
class ObjectDataClient:
|
|
71
91
|
"""An optional wrapper around data upload and download functionality for geoscience objects.
|
|
72
92
|
|
|
@@ -203,7 +223,7 @@ class ObjectDataClient:
|
|
|
203
223
|
columns_chunk_range = []
|
|
204
224
|
for column in table.itercolumns():
|
|
205
225
|
column = column.dictionary_encode()
|
|
206
|
-
if not
|
|
226
|
+
if not pa.types.is_string(column.type.value_type):
|
|
207
227
|
raise TableFormatError("Category columns must be of type string")
|
|
208
228
|
if not pa.types.is_int32(column.type.index_type):
|
|
209
229
|
# Currently, we only support int32 indices
|
|
@@ -231,8 +251,6 @@ class ObjectDataClient:
|
|
|
231
251
|
)
|
|
232
252
|
|
|
233
253
|
dictionary_values = all_chunks[0].dictionary
|
|
234
|
-
if pa.types.is_large_string(dictionary_values.type):
|
|
235
|
-
dictionary_values = pc.cast(dictionary_values, pa.string())
|
|
236
254
|
lookup = pa.Table.from_arrays(
|
|
237
255
|
[np.arange(len(dictionary_values), dtype=np.int32), dictionary_values], names=["key", "value"]
|
|
238
256
|
)
|
|
@@ -300,7 +318,9 @@ class ObjectDataClient:
|
|
|
300
318
|
no table formats are specified, raised when the table does not match any known format.
|
|
301
319
|
:raises StorageFileNotFoundError: If the destination does not exist or is not a directory.
|
|
302
320
|
"""
|
|
303
|
-
|
|
321
|
+
schema = _get_schema_from_dataframe(dataframe)
|
|
322
|
+
table = pa.Table.from_pandas(dataframe, schema)
|
|
323
|
+
return self.save_table(table, table_format=table_format)
|
|
304
324
|
|
|
305
325
|
async def upload_dataframe(
|
|
306
326
|
self,
|
|
@@ -322,7 +342,9 @@ class ObjectDataClient:
|
|
|
322
342
|
:raises TableFormatError: If the provided table does not match any of the specified formats. If
|
|
323
343
|
no table formats are specified, raised when the table does not match any known format.
|
|
324
344
|
"""
|
|
325
|
-
|
|
345
|
+
schema = _get_schema_from_dataframe(dataframe)
|
|
346
|
+
table = pa.Table.from_pandas(dataframe, schema)
|
|
347
|
+
table_info = await self.upload_table(table, table_format=table_format, fb=fb)
|
|
326
348
|
return table_info
|
|
327
349
|
|
|
328
350
|
async def upload_category_dataframe(self, dataframe: pd.DataFrame, fb: IFeedback = NoFeedback) -> CategoryInfo:
|
|
@@ -342,7 +364,9 @@ class ObjectDataClient:
|
|
|
342
364
|
:raises TableFormatError: If the table isn't a valid category table, or if the number of categories exceeds
|
|
343
365
|
what int32 type can represent.
|
|
344
366
|
"""
|
|
345
|
-
|
|
367
|
+
schema = _get_schema_from_dataframe(dataframe)
|
|
368
|
+
table = pa.Table.from_pandas(dataframe, schema)
|
|
369
|
+
category_info = await self.upload_category_table(table, fb=fb)
|
|
346
370
|
return category_info
|
|
347
371
|
|
|
348
372
|
async def download_dataframe(
|
|
@@ -64,7 +64,7 @@ class _ColumnFormat:
|
|
|
64
64
|
return pa.int64()
|
|
65
65
|
case "bool":
|
|
66
66
|
return pa.bool_()
|
|
67
|
-
case "string"
|
|
67
|
+
case "string":
|
|
68
68
|
return pa.string()
|
|
69
69
|
case "timestamp":
|
|
70
70
|
return pa.timestamp("us", tz="UTC")
|
|
@@ -88,7 +88,7 @@ class _ColumnFormat:
|
|
|
88
88
|
return "int64"
|
|
89
89
|
case "bool":
|
|
90
90
|
return "bool"
|
|
91
|
-
case "string"
|
|
91
|
+
case "string":
|
|
92
92
|
return "string"
|
|
93
93
|
case "timestamp[us, tz=UTC]":
|
|
94
94
|
return "timestamp"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|