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

old

parent 5aecb4b0
No related branches found
No related tags found
No related merge requests found
import os, sys, glob, shutil #import os, sys, glob, shutil
from utils import try_remove #from utils import try_remove
#
"""Run this script to reduce wrfrst files #"""Run this script to reduce wrfrst files
#
Example call: #Example call:
python ./cleanup_exp.py # python ./cleanup_exp.py
""" #"""
keep_last_init_wrfrst = True #keep_last_init_wrfrst = True
#
datadir = '/gpfs/data/fs71386/lkugler/sim_archive/' #datadir = '/gpfs/data/fs71386/lkugler/sim_archive/'
#exp = sys.argv[1] ##exp = sys.argv[1]
for exp in os.listdir(datadir): #for exp in os.listdir(datadir):
#
print('removing files for exp', exp) # print('removing files for exp', exp)
#
inits = glob.glob(datadir+exp+'/20??-??-??_??:??') # inits = glob.glob(datadir+exp+'/20??-??-??_??:??')
for init in inits: # for init in inits:
for iens in range(1, 41): # for iens in range(1, 41):
rst_files = sorted(glob.glob(init+'/'+str(iens)+'/wrfrst_*')) # rst_files = sorted(glob.glob(init+'/'+str(iens)+'/wrfrst_*'))
#print(rst_files) # #print(rst_files)
if len(rst_files)>1: # if len(rst_files)>1:
for f in sorted(rst_files)[:-1]: # for f in sorted(rst_files)[:-1]:
try_remove(f) # try_remove(f)
print(f, 'removed') # print(f, 'removed')
#
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment