From abc1a587246c28a62ee45a9cca4d5ba161fad961 Mon Sep 17 00:00:00 2001
From: lkugler <lukas.kugler@gmail.com>
Date: Mon, 5 Jun 2023 17:03:10 +0200
Subject: [PATCH] hist_interval, radt as arguments to run_ENS

---
 dartwrf/workflows.py | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/dartwrf/workflows.py b/dartwrf/workflows.py
index 83b780d..5d2257b 100644
--- a/dartwrf/workflows.py
+++ b/dartwrf/workflows.py
@@ -169,7 +169,7 @@ class WorkFlows(object):
         return id
 
     def run_ENS(self, begin, end, depends_on=None, first_minute=False, 
-                input_is_restart=True, output_restart_interval=720):
+                input_is_restart=True, output_restart_interval=720, hist_interval=5, radt=5):
         """Run the forecast ensemble
 
         Args:
@@ -179,6 +179,8 @@ class WorkFlows(object):
             first_minute (bool, optional): if True, run the first minute of the forecast
             input_is_restart (bool, optional): if True, start WRF from WRFrst file (restart mode)
             output_restart_interval (int, optional): interval in minutes between output of WRFrst files
+            hist_interval (int, optional): interval in minutes between output of WRF history files
+            radt (int, optional): time step of radiation scheme
 
         Returns:
             str: job ID of the submitted job
@@ -189,12 +191,13 @@ class WorkFlows(object):
             args = [self.cluster.python, self.cluster.scripts_rundir+'/prepare_namelist.py',
                     begin.strftime('%Y-%m-%d_%H:%M'), end.strftime('%Y-%m-%d_%H:%M'),
                     str(hist_interval), '--radt='+str(radt), '--restart='+restart_flag,]
+
             if output_restart_interval:
                 args.append('--restart_interval='+str(int(float(output_restart_interval))))
 
-            return self.cluster.run_job(' '.join(args), "preWRF", cfg_update=dict(time="2"), depends_on=[depends_on])
+            return self.cluster.run_job(' '.join(args), "preWRF", 
+                        cfg_update=dict(time="2"), depends_on=[depends_on])
         
-
         id = depends_on
         restart_flag = '.false.' if not input_is_restart else '.true.'
         wrf_cmd = script_to_str(self.cluster.run_WRF
@@ -202,13 +205,13 @@ class WorkFlows(object):
                 ).replace('<cluster.wrf_rundir_base>', self.cluster.wrf_rundir_base
                 ).replace('<cluster.wrf_modules>', self.cluster.wrf_modules)
 
-
         # first minute forecast (needed for validating a radiance assimilation)
         if first_minute:
-            hist_interval = 1  # to get an output after 1 minute
-            radt = 1  # to get a cloud fraction CFRAC after 1 minute
             id = prepare_WRF_inputfiles(begin, begin+dt.timedelta(minutes=1), 
-                    hist_interval=hist_interval, radt=radt, output_restart_interval=output_restart_interval, depends_on=id)
+                    hist_interval=1,  # to get an output after 1 minute
+                    radt = 1,  # to get a cloud fraction CFRAC after 1 minute
+                    output_restart_interval=output_restart_interval, 
+                    depends_on=id)
 
             id = self.cluster.run_job(wrf_cmd, "WRF-"+exp.expname, 
                                       cfg_update={"array": "1-"+str(self.cluster.size_jobarray), "ntasks": "10", "nodes": "1",
@@ -216,7 +219,12 @@ class WorkFlows(object):
                                       depends_on=[id])
 
         # forecast for the whole forecast duration       
-        id = prepare_WRF_inputfiles(begin, end, depends_on=id)
+        id = prepare_WRF_inputfiles(begin, end, 
+                                    hist_interval=hist_interval, 
+                                    radt=radt,
+                                    output_restart_interval=output_restart_interval,
+                                    depends_on=id)
+
         time_in_simulation_hours = (end-begin).total_seconds()/3600
         runtime_wallclock_mins_expected = int(8+time_in_simulation_hours*9)  # usually below 9 min/hour
         id = self.cluster.run_job(wrf_cmd, "WRF-"+exp.expname, 
-- 
GitLab