From 99fd4eeaed26a94bb31d6d46ae086428330d0531 Mon Sep 17 00:00:00 2001
From: lkugler <lukas.kugler@gmail.com>
Date: Thu, 3 Feb 2022 16:12:18 +0100
Subject: [PATCH] small fix

---
 dartwrf/cleanup_exp.py | 11 +++++------
 dartwrf/obsseq.py      |  2 +-
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/dartwrf/cleanup_exp.py b/dartwrf/cleanup_exp.py
index bee76fe..3b913cb 100644
--- a/dartwrf/cleanup_exp.py
+++ b/dartwrf/cleanup_exp.py
@@ -1,4 +1,4 @@
-import os, glob
+import os, glob, shutil
 from config.cfg import exp, cluster
 from utils import try_remove
 
@@ -10,7 +10,7 @@ from utils import try_remove
 """
 keep_last_init_wrfrst = True
 
-print('removing files for exp', exp)
+print('removing files for exp', exp.expname)
 
 # 1) wrfrst
 inits = reversed(sorted(glob.glob(cluster.archivedir+'/20??-??-??_??:??')))
@@ -27,9 +27,8 @@ for k, init in enumerate(inits):
             try_remove(f)
 
 # 2) run_DART/exp
-os.removedirs(cluster.dartrundir)
+shutil.rmtree(cluster.dartrundir, ignore_errors=True)
 
 # 3) run_WRF/exp
-for iens in range(1, exp.n_ens+1):
-    os.removedirs(cluster.wrf_rundir(iens))
-    print(cluster.wrf_rundir(iens), 'removed.')
+shutil.rmtree(cluster.wrf_rundir_base+'/'+exp.expname, ignore_errors=True)
+print(cluster.wrf_rundir_base+'/'+exp.expname, 'removed.')
diff --git a/dartwrf/obsseq.py b/dartwrf/obsseq.py
index e7db51d..fe8c5da 100755
--- a/dartwrf/obsseq.py
+++ b/dartwrf/obsseq.py
@@ -3,7 +3,7 @@ import numpy as np
 import pandas as pd
 
 from config.cfg import exp, cluster
-from utils import symlink, copy, sed_inplace, append_file, mkdir, try_remove
+from dartwrf.utils import symlink, copy, sed_inplace, append_file, mkdir, try_remove
 
 
 def plot_box(m, lat, lon, label="", **kwargs):
-- 
GitLab