Skip to content
Snippets Groups Projects
Commit d8265e05 authored by lkugler's avatar lkugler
Browse files

all exps at once

parent 8eda9dbe
Branches
Tags
No related merge requests found
import os, glob, shutil import os, sys, glob, shutil
from config.cfg import exp, cluster
from utils import try_remove from utils import try_remove
"""Run this script after an experiment to reduce cluster disk usage. """Run this script to reduce wrfrst files
1) remove wrfrst Example call:
2) remove run_DART folders from exp python ./cleanup_exp.py
3) remove run_WRF files from exp
""" """
keep_last_init_wrfrst = True keep_last_init_wrfrst = True
print('removing files for exp', exp.expname) datadir = '/gpfs/data/fs71386/lkugler/sim_archive/'
#exp = sys.argv[1]
# 1) wrfrst for exp in os.listdir(datadir):
inits = reversed(sorted(glob.glob(cluster.archivedir+'/20??-??-??_??:??')))
for k, init in enumerate(inits): print('removing files for exp', exp)
rst_files = glob.glob(init+'/*/wrfrst_*')
inits = glob.glob(datadir+exp+'/20??-??-??_??:??')
if k == 0: # last init of exp for init in inits:
for iens in range(1, 41):
if not keep_last_init_wrfrst: rst_files = sorted(glob.glob(init+'/'+str(iens)+'/wrfrst_*'))
for f in rst_files: #print(rst_files)
try_remove(f) if len(rst_files)>1:
else: for f in sorted(rst_files)[:-1]:
for f in rst_files: try_remove(f)
try_remove(f) print(f, 'removed')
# 2) run_DART/exp
shutil.rmtree(cluster.dartrundir, ignore_errors=True)
# 3) run_WRF/exp
shutil.rmtree(cluster.wrf_rundir_base+'/'+exp.expname, ignore_errors=True)
print(cluster.wrf_rundir_base+'/'+exp.expname, 'removed.')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment