Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DART-WRF
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
DataAssimilation
DART-WRF
Commits
d8265e05
Commit
d8265e05
authored
3 years ago
by
lkugler
Browse files
Options
Downloads
Patches
Plain Diff
all exps at once
parent
8eda9dbe
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dartwrf/cleanup_exp.py
+20
-28
20 additions, 28 deletions
dartwrf/cleanup_exp.py
with
20 additions
and
28 deletions
dartwrf/cleanup_exp.py
+
20
−
28
View file @
d8265e05
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.
'
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment