File size: 575 Bytes
aa8cca6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import os
from onescience.utils.YParams import YParams
import json
import sys


def main():
    config_file_path = os.path.join(current_path, 'conf/config.yaml')
    cfg_data = YParams(config_file_path, "datapipe")
    metadata = {
        "coords": {
            "channel": {str(i): name for i, name in enumerate(cfg_data.dataset.channels)}
        }
    }
    with open('./data.json', "w") as f:
        json.dump(metadata, f, indent=4)
    print(f"Metadata saved.")



if __name__ == '__main__':
    current_path = os.getcwd()
    sys.path.append(current_path)
    main()