From f991b4467fa2ceb861d53e1c6442b1154ec9c57b Mon Sep 17 00:00:00 2001
From: Lukas Kugler <lukas.kugler@univie.ac.at>
Date: Mon, 31 Mar 2025 17:53:03 +0200
Subject: [PATCH] only remove wrfrst files (for speedup)

---
 dartwrf/prep_IC_prior.py | 8 +++++---
 dartwrf/utils.py         | 6 ------
 2 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/dartwrf/prep_IC_prior.py b/dartwrf/prep_IC_prior.py
index 8a8a841..7c67351 100755
--- a/dartwrf/prep_IC_prior.py
+++ b/dartwrf/prep_IC_prior.py
@@ -1,6 +1,6 @@
-import os, sys
+import os, sys, glob
 import datetime as dt
-from dartwrf.utils import copy, clean_wrfdir, Config
+from dartwrf.utils import copy, Config
 
 """
 Sets initial condition data (wrfinput/wrfrst file) in the run_WRF directory for each ensemble member 
@@ -21,7 +21,9 @@ def create_wrfrst_in_WRF_rundir(time: dt.datetime, prior_init_time: dt.datetime,
     """
     for iens in range(1, cfg.ensemble_size+1):
         dir_wrf_run = cfg.dir_wrf_run.replace('<exp>', cfg.name).replace('<ens>', str(iens))
-        clean_wrfdir(dir_wrf_run)
+        
+        for f in glob.glob(dir_wrf_run+'/wrfrst_*'):
+            os.remove(f)
     
         prior_wrfrst = prior_path_exp + prior_init_time.strftime('/%Y-%m-%d_%H:%M/') \
                        +str(iens)+time.strftime('/wrfrst_d01_%Y-%m-%d_%H:%M:%S')
diff --git a/dartwrf/utils.py b/dartwrf/utils.py
index 798ad1a..171a414 100755
--- a/dartwrf/utils.py
+++ b/dartwrf/utils.py
@@ -270,12 +270,6 @@ def copy_contents(src, dst):
     os.system('cp -rf '+src+'/* '+dst+'/')
 
 
-def clean_wrfdir(dir):
-    for s in ['wrfout_*', 'rsl.*', 'wrfrst_*']:
-        for f in glob.glob(dir+'/'+s):
-            os.remove(f)
-
-
 def symlink(src, dst):
     """Create a symbolic link from src to dst
     Creates the folder if it does not exist
-- 
GitLab