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 80a7b650 authored by florez_j's avatar florez_j
Browse files

Merge branch 'main' of https://gitlab.psi.ch/5505/dima

parents f483e8d7 fed9aa0a
No related branches found
No related tags found
No related merge requests found
import sys
import os
root_dir = os.path.abspath(os.curdir)
sys.path.append(root_dir)
try:
thisFilePath = os.path.abspath(__file__)
except NameError:
print("Error: __file__ is not available. Ensure the script is being run from a file.")
print("[Notice] Path to DIMA package may not be resolved properly.")
thisFilePath = os.getcwd() # Use current directory or specify a default
dimaPath = os.path.normpath(os.path.join(thisFilePath, "..",'..')) # Move up to project root
if dimaPath not in sys.path: # Avoid duplicate entries
sys.path.append(dimaPath)
import h5py
import pandas as pd
......@@ -12,7 +23,6 @@ import src.hdf5_writer as hdf5_lib
import logging
import datetime
import os
import h5py
import yaml
......@@ -640,17 +650,20 @@ def read_mtable_as_dataframe(filename):
return output_dataframe
if __name__ == "__main__":
if len(sys.argv) < 4:
print("Usage: python hdf5_ops.py serialize <path/to/target_file.hdf5> <format=json|yaml>")
if len(sys.argv) < 5:
print("Usage: python hdf5_ops.py serialize <path/to/target_file.hdf5> <folder_depth : int = 2> <format=json|yaml>")
sys.exit(1)
if sys.argv[1] == 'serialize':
input_hdf5_file = sys.argv[2]
file_format = sys.argv[3]
folder_depth = int(sys.argv[3])
file_format = sys.argv[4]
try:
# Call the serialize_metadata function and capture the output path
path_to_file = serialize_metadata(input_hdf5_file, output_format=file_format)
path_to_file = serialize_metadata(input_hdf5_file,
folder_depth = folder_depth,
output_format=file_format)
print(f"Metadata serialized to {path_to_file}")
except Exception as e:
print(f"An error occurred during serialization: {e}")
......
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