Download scripts/clean_stokes.py from AlanZee/diffvof-simulation-data: direct link, hf CLI and curl.
- Browser
- Download file 969 Bytes
-
https://huggingface.co/datasets/AlanZee/diffvof-simulation-data/resolve/efe4440f90c7a07ecbdbf22fc2fecac2d8d74ad2/scripts/clean_stokes.py
- Command line
-
hf download hf://datasets/AlanZee/diffvof-simulation-data@efe4440f90c7a07ecbdbf22fc2fecac2d8d74ad2/scripts/clean_stokes.py
-
curl -L -o clean_stokes.py https://huggingface.co/datasets/AlanZee/diffvof-simulation-data/resolve/efe4440f90c7a07ecbdbf22fc2fecac2d8d74ad2/scripts/clean_stokes.py
969 Bytes
| #!/usr/bin/env python3 | |
| """清理 stokes_wave 的 processor 目录和旧时间步""" | |
| import os, shutil, subprocess | |
| raw = '/mnt/f/agent-workspace/paper2/Exp/data/raw/stokes_wave' | |
| for d in sorted(os.listdir(raw)): | |
| if not d.startswith('t'): | |
| continue | |
| case_dir = os.path.join(raw, d) | |
| # 清理 processor 目录 | |
| for e in os.listdir(case_dir): | |
| if e.startswith('processor'): | |
| path = os.path.join(case_dir, e) | |
| subprocess.run(['rm', '-rf', path], check=False) | |
| # 清理非0时间步 | |
| for e in os.listdir(case_dir): | |
| if e.replace('.', '').isdigit() and e != '0': | |
| path = os.path.join(case_dir, e) | |
| if os.path.isdir(path): | |
| shutil.rmtree(path, ignore_errors=True) | |
| else: | |
| os.remove(path) | |
| # 清空 log | |
| log = os.path.join(case_dir, 'log.interFoam') | |
| if os.path.isfile(log): | |
| open(log, 'w').write('') | |
| print('Cleaned stokes_wave cases') | |