From 9fcb9f63711220b4dc96b61ed493a10126b70523 Mon Sep 17 00:00:00 2001
From: lkugler <lukas.kugler@gmail.com>
Date: Wed, 7 Jun 2023 14:13:57 +0200
Subject: [PATCH] .

---
 free_forecast.py | 63 ++++++++++++++++++++++++------------------------
 1 file changed, 32 insertions(+), 31 deletions(-)

diff --git a/free_forecast.py b/free_forecast.py
index 1485c29..1a3ab86 100755
--- a/free_forecast.py
+++ b/free_forecast.py
@@ -8,7 +8,7 @@ import pandas as pd
 from dartwrf.workflows import WorkFlows
 
 
-w = WorkFlows(exp_config='nature.py', server_config='jet.py')
+w = WorkFlows(exp_config='exp_template.py', server_config='jet.py')
 id = None
 
 
@@ -26,7 +26,7 @@ if False: # generate_nature
     # id = w.create_satimages(begin, depends_on=id)
 
 
-if True:  # to continue a nature
+if False:  # to continue a nature
 
     start = dt.datetime(2008, 7, 30, 12)
     id = w.prepare_WRFrundir(start)  # create initial conditions
@@ -80,61 +80,62 @@ if True:  # to continue a nature
 
 
 
-if False:   # do a free run (all inits)
-    begin = dt.datetime(2008, 7, 30, 12)
-    id = w.prepare_WRFrundir(begin)  # create initial conditions
-    id = w.run_ideal(depends_on=id)
+if True:   # do a free run (all inits)
+    begin = dt.datetime(2008, 7, 30, 12,30)
+    #id = w.prepare_WRFrundir(begin)  # create initial conditions
+    # id = w.run_ideal(depends_on=id)
 
     #id = wrfinput_insert_wbubble(perturb=True, depends_on=id)
 
-    # restarts = pd.date_range(start=dt.datetime(2008, 7, 30, 10),
-    #                           end=dt.datetime(2008, 7, 30, 12),
-    #                           freq=dt.timedelta(minutes=60))
-    restarts = [dt.datetime(2008, 7, 30, 12, 30)]
+    restarts = pd.date_range(start=dt.datetime(2008, 7, 30, 13),
+                              end=dt.datetime(2008, 7, 30, 14,30),
+                              freq=dt.timedelta(minutes=30))
+    # restarts = [dt.datetime(2008, 7, 30, 12, 30)]
     
-    input_is_restart = False
+    input_is_restart = True
     time = begin
-    last_init = dt.datetime(2008, 7, 30, 9)  # dummy value
+    last_init = dt.datetime(2008, 7, 30, 12) 
+
     for i, next_restart in enumerate(restarts):
         print('run_WRF from', time, 'to', next_restart)
+
+        prior_path_exp = '/jetfs/scratch/lkugler/data/sim_archive/exp_v1.19_P2_noDA+1/' #w.cluster.archivedir
+        prior_init_time = last_init
+        prior_valid_time = time
+        id = w.prepare_IC_from_prior(prior_path_exp, prior_init_time, prior_valid_time, depends_on=id)
+
         id = w.run_ENS(begin=time, end=next_restart, 
                      input_is_restart=input_is_restart,
                      output_restart_interval=(next_restart-time).total_seconds()/60,
+                     first_minute=True,
                      #output_restart_interval=720,
                      depends_on=id)
 
         last_init = time
         time = next_restart
         input_is_restart = True
-        w.create_satimages(last_init, depends_on=id)
-
-        prior_path_exp = w.cluster.archivedir
-        prior_init_time = last_init
-        prior_valid_time = time
-        id = w.prepare_IC_from_prior(prior_path_exp, prior_init_time, prior_valid_time, depends_on=id)
+        id_sat = w.create_satimages(last_init, depends_on=id)
 
     # free run, no restart files anymore
-    end = dt.datetime(2008, 7, 30, 18)
-    print('run WRF from', time, 'until', end)
-    id = w.run_ENS(begin=time, end=end,
-             input_is_restart=input_is_restart,
-             #output_restart_interval=(next_restart-time).total_seconds()/60,
-             output_restart_interval=9999,
-             depends_on=id)
-    
+    # end = dt.datetime(2008, 7, 30, 18)
+    # print('run WRF from', time, 'until', end)
+    # id = w.run_ENS(begin=time, end=end,
+    #          input_is_restart=input_is_restart,
+    #          #output_restart_interval=(next_restart-time).total_seconds()/60,
+    #          output_restart_interval=9999,
+    #          depends_on=id)
     
     w.verify_wrf(depends_on=id)
-    id = w.create_satimages(time, depends_on=id)
-    w.verify_sat(depends_on=id)
+    #id = w.create_satimages(time, depends_on=id)
+    w.verify_sat(depends_on=id_sat)
 
 if False:  # to continue a free run
     start = dt.datetime(2008, 7, 30, 7)
-    end = dt.datetime(2008, 7, 30, 10)
 
     id = w.prepare_WRFrundir(start)  # create initial conditions
 
-    prior_path_exp = '/gpfs/data/fs71386/lkugler/sim_archive/exp_v1.19_P5_noDA' # w.cluster.archivedir
-    prior_init_time = dt.datetime(2008, 7, 30, 11)
+    prior_path_exp = '/jetfs/scratch/lkugler/data/sim_archive/exp_v1.19_P2_noDA' # w.cluster.archivedir
+    prior_init_time = dt.datetime(2008, 7, 30, 7)
     prior_valid_time = start
 
     id = w.prepare_IC_from_prior(prior_path_exp, prior_init_time, prior_valid_time, depends_on=id)
-- 
GitLab