From 21edb694a9fb5fe8e79e9e4ef7ffaf414408ce49 Mon Sep 17 00:00:00 2001
From: lkugler <lukas.kugler@gmail.com>
Date: Mon, 22 May 2023 17:57:11 +0200
Subject: [PATCH] fix if inflation 2

---
 config/exp_template.py     | 6 +++---
 dartwrf/assim_synth_obs.py | 6 +++---
 dartwrf/workflows.py       | 3 ++-
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/config/exp_template.py b/config/exp_template.py
index c45c6f7..8a14c5d 100755
--- a/config/exp_template.py
+++ b/config/exp_template.py
@@ -3,7 +3,7 @@ from dartwrf import utils
 exp = utils.Experiment()
 exp.expname = "test_newcode" #exp_v1.22_P2_rr_VIS_obs10_loc20_oe3"
 exp.model_dx = 2000
-exp.n_ens = 40
+exp.n_ens = 10
 exp.superob_km = False  # False or int (spatial averaging of observations)
 
 exp.use_existing_obsseq = False  # False or pathname (use precomputed obs_seq.out files)
@@ -25,10 +25,10 @@ exp.dart_nml = {'&assim_tools_nml':
                             num_output_state_members=exp.n_ens,
                             num_output_obs_members=exp.n_ens,
                             inf_flavor=['0', '0'],
-                            output_members='.true',
+                            output_members='.true.',
                             output_mean='.true.',
                             output_sd='.true.',
-                            stages_to_write=[''],
+                            stages_to_write='output',
                         ),
                 '&location_nml':
                     dict(horiz_dist_only='.true.',
diff --git a/dartwrf/assim_synth_obs.py b/dartwrf/assim_synth_obs.py
index a189db7..e3860f3 100755
--- a/dartwrf/assim_synth_obs.py
+++ b/dartwrf/assim_synth_obs.py
@@ -529,6 +529,7 @@ def main(time, prior_init_time, prior_valid_time, prior_path_exp):
 
     prepare_run_DART_folder()
     nml = dart_nml.write_namelist()
+    prior_inflation_type = nml['&filter_nml']['inf_flavor'][0][0]
 
     print("prepare nature")
     prepare_nature_dart(time)  # link WRF files to DART directory
@@ -549,8 +550,7 @@ def main(time, prior_init_time, prior_valid_time, prior_path_exp):
         print(" 2.3) reject observations? ")
         qc_obs(time, oso, osf_prior)
 
-    print('prior inflation=', nml['&filter_nml']['inf_flavor'][0])
-    if nml['&filter_nml']['inf_flavor'][0]:
+    if prior_inflation_type == '2':
         prepare_inflation_2(time, prior_init_time)
 
     print(" 3) run filter ")
@@ -558,7 +558,7 @@ def main(time, prior_init_time, prior_valid_time, prior_path_exp):
     filter(nproc=nproc)
     archive_filteroutput(time)
 
-    if exp.dart_nml:
+    if prior_inflation_type == '2':
         archive_inflation_2(time)
 
     print(" 4) evaluate posterior observations for all observations (incl rejected)")
diff --git a/dartwrf/workflows.py b/dartwrf/workflows.py
index 1a08071..1eb4560 100644
--- a/dartwrf/workflows.py
+++ b/dartwrf/workflows.py
@@ -24,7 +24,6 @@ class WorkFlows(object):
 
         we load the config from load the config from cluster.scripts_rundir/config/cfg.py
         """
-        print('------ start exp from ', exp_config, ' and ', server_config, ' ------')
 
         def copy_dartwrf_to_archive():
             # Copy scripts to self.cluster.archivedir folder
@@ -50,6 +49,8 @@ class WorkFlows(object):
             # later, we can load the cluster cfg with `from config.cluster import cluster`
             shutil.copyfile('config/'+server_config, self.cluster.scripts_rundir+'/config/cluster.py')  # whatever server, the config name is always the same!
 
+        print('------ start exp from ', exp_config, ' and ', server_config, ' ------')
+
         # copy config file to current config folder
         try:
             shutil.copyfile('config/'+exp_config, '/'.join(__file__.split('/')[:-2])+'/config/cfg.py')
-- 
GitLab