Download scripts/clean_raw.py from AlanZee/diffvof-simulation-data: direct link, hf CLI and curl.
- Browser
- Download file 1.08 kB
-
https://huggingface.co/datasets/AlanZee/diffvof-simulation-data/resolve/main/scripts/clean_raw.py
- Command line
-
hf download hf://datasets/AlanZee/diffvof-simulation-data/scripts/clean_raw.py
-
curl -L -o clean_raw.py https://huggingface.co/datasets/AlanZee/diffvof-simulation-data/resolve/main/scripts/clean_raw.py
1.08 kB
| #!/usr/bin/env python3 | |
| """清理 raw/ 下所有 case 的中间时间步、log、processor、postProcessing, | |
| 只保留 0/ constant/ system/ Allrun Allclean(初始条件和配置)""" | |
| import os, shutil | |
| raw = '/mnt/f/agent-workspace/paper2/Exp/data/raw' | |
| keep = {'0', 'constant', 'system', 'Allrun', 'Allclean'} | |
| total_removed = 0 | |
| for ct in sorted(os.listdir(raw)): | |
| ct_dir = os.path.join(raw, ct) | |
| if not os.path.isdir(ct_dir): | |
| continue | |
| for case in sorted(os.listdir(ct_dir)): | |
| case_dir = os.path.join(ct_dir, case) | |
| if not os.path.isdir(case_dir): | |
| continue | |
| for entry in os.listdir(case_dir): | |
| if entry in keep: | |
| continue | |
| path = os.path.join(case_dir, entry) | |
| try: | |
| if os.path.isdir(path): | |
| shutil.rmtree(path) | |
| else: | |
| os.remove(path) | |
| total_removed += 1 | |
| except Exception as e: | |
| print(f' WARN: {path}: {e}') | |
| print(f'Cleaned {total_removed} entries from {raw}') | |