-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Metadata functionality in
EnsembleTableProvider
(#1135)
- Loading branch information
Showing
7 changed files
with
82 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
webviz_subsurface/_providers/ensemble_table_provider/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
from .ensemble_table_provider import EnsembleTableProvider | ||
from .ensemble_table_provider import ColumnMetadata, EnsembleTableProvider | ||
from .ensemble_table_provider_factory import EnsembleTableProviderFactory | ||
from .ensemble_table_provider_impl_arrow import EnsembleTableProviderImplArrow |
24 changes: 24 additions & 0 deletions
24
webviz_subsurface/_providers/ensemble_table_provider/_field_metadata.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from typing import Optional | ||
|
||
import pyarrow as pa | ||
|
||
from .ensemble_table_provider import ColumnMetadata | ||
|
||
|
||
def create_column_metadata_from_field_meta( | ||
field: pa.Field, | ||
) -> Optional[ColumnMetadata]: | ||
"""Create VectorMetadata from keywords stored in the field's metadata""" | ||
|
||
meta_dict = field.metadata | ||
if not meta_dict: | ||
return None | ||
|
||
try: | ||
unit_bytestr = meta_dict[b"unit"] | ||
except KeyError: | ||
return ColumnMetadata(unit=None) | ||
|
||
return ColumnMetadata( | ||
unit=unit_bytestr.decode("ascii"), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters