Included cli commands update and serialize to simplify running metadata revision pipeline.

This commit is contained in:
2024-10-29 07:56:43 +01:00
parent 3f7a089a28
commit e2fec03d4a
2 changed files with 30 additions and 7 deletions

View File

@ -1,5 +1,9 @@
import sys
import os
# Add the parent directory to the system path
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import h5py
import yaml
import src.hdf5_ops as hdf5_ops
@ -153,12 +157,14 @@ def count(hdf5_obj,yml_dict):
print('additions',count_additions, 'deletions', count_delections)
if __name__ == "__main__":
if len(sys.argv) != 4:
print("Usage: python metadata_revision.py update <path/to/review_file.hdf5> <path/to/review_file.yaml>")
sys.exit(1)
if sys.argv[2] == 'update':
input_hdf5_file = sys.argv[3]
yaml_review_file = sys.argv[4]
if len(sys.argv) < 4:
print("Usage: python metadata_revision.py update <path/to/target_file.hdf5> <path/to/metadata_review_file.yaml>")
sys.exit(1)
if sys.argv[1] == 'update':
input_hdf5_file = sys.argv[2]
yaml_review_file = sys.argv[3]
update_hdf5_file_with_review(input_hdf5_file, yaml_review_file)
#run(sys.argv[2])