Download scripts/get_data_json.py from OneScience-Group/GraphCast: direct link, hf CLI and curl.
- Browser
- Download file 575 Bytes
-
https://huggingface.co/OneScience-Group/GraphCast/resolve/main/scripts/get_data_json.py
- Command line
-
hf download hf://OneScience-Group/GraphCast/scripts/get_data_json.py
-
curl -L -o get_data_json.py https://huggingface.co/OneScience-Group/GraphCast/resolve/main/scripts/get_data_json.py
575 Bytes
| 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() | |