Code indexing in gitaly is broken and leads to code not being visible to the user. We work on the issue with highest priority.

Skip to content
Snippets Groups Projects
Commit d89aebd8 authored by florez_j's avatar florez_j
Browse files

Implement method in hdf5 manager to infer datetime column in dataset

parent e358d4ab
No related branches found
No related tags found
No related merge requests found
......@@ -96,6 +96,28 @@ class HDF5DataOpsManager():
print(f"An unexpected error occurred: {e}. File object will be unloaded.")
def infer_datetime_variable(self,dataset_name):
if self.file_obj is None:
raise RuntimeError("File object is not loaded. Please load the HDF5 file using the 'load_file_obj' method before attempting to extract datasets.")
metadata_dict = self.get_metadata(dataset_name)
datetime_var = None
datetime_format = None
for key in metadata_dict.keys(): # by construction key correspond to column/variable names
if not utils.is_structured_array(metadata_dict[key]):
continue
if 'data_type' in metadata_dict[key].dtype.names:
if metadata_dict[key][0]['data_type'].decode() == 'datetime':
datetime_var = key
datetime_format = metadata_dict[key]['datetime_format'][0].decode()
return datetime_var, datetime_format
return None
def extract_dataset_as_dataframe(self,dataset_name):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment