Skip to content

Commit

Permalink
Remove table_index_values
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-sol committed Oct 3, 2023
1 parent 8bd0308 commit b4d0d19
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 22 deletions.
23 changes: 2 additions & 21 deletions src/fmu/dataio/_objectdata_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,7 @@ def _derive_objectdata(self):

elif isinstance(self.obj, pd.DataFrame):
result["table_index"] = self._derive_index()
result["table_index_values"] = self._derive_values_from_index(
result["table_index"]
)

result["subtype"] = "DataFrame"
result["classname"] = "table"
result["layout"] = "table"
Expand All @@ -290,9 +288,7 @@ def _derive_objectdata(self):

elif HAS_PYARROW and isinstance(self.obj, pa.Table):
result["table_index"] = self._derive_index()
result["table_index_values"] = self._derive_values_from_index(
result["table_index"]
)

result["subtype"] = "ArrowTable"
result["classname"] = "table"
result["layout"] = "table"
Expand Down Expand Up @@ -517,20 +513,6 @@ def _get_columns(self):
logger.debug("Available columns in table %s ", columns)
return columns

def _derive_values_from_index(self, table_index):
"""Get unique values in table_index columns"""
index_values = {}
for index_name in table_index:
if isinstance(self.obj, pd.DataFrame):
logger.debug("pandas")
index_values[index_name] = self.obj[index_name].unique()
else:
logger.debug("arrow")
index_values[index_name] = pc.unique(
self.obj.column(index_name)
).tolist()
return index_values

def _derive_index(self):
"""Derive table index"""
# This could in the future also return context
Expand Down Expand Up @@ -720,7 +702,6 @@ def derive_metadata(self):
meta["spec"] = objres["spec"]
meta["bbox"] = objres["bbox"]
meta["table_index"] = objres.get("table_index")
meta["table_index_values"] = objres.get("table_index_values")
meta["undef_is_zero"] = self.dataio.undef_is_zero

# timedata:
Expand Down
1 change: 0 additions & 1 deletion src/fmu/dataio/dataio.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,6 @@ class ExportData:
vertical_domain: dict = field(default_factory=dict)
workflow: str = ""
table_index: Optional[list] = None
table_index_values: Optional[dict] = None

# some keys that are modified version of input, prepended with _use
_usecontent: dict = field(default_factory=dict, init=False)
Expand Down

0 comments on commit b4d0d19

Please sign in to comment.