From 1b551ccacc21a9403d052a45a3874bae8fe8a4e1 Mon Sep 17 00:00:00 2001
From: lkugler <lukas.kugler@gmail.com>
Date: Tue, 28 May 2024 21:10:05 +0200
Subject: [PATCH] less printing

---
 dartwrf/prepare_namelist.py  |  4 ++--
 dartwrf/prepare_wrfrundir.py |  6 +++---
 dartwrf/workflows.py         | 31 +++++++++++++++++--------------
 3 files changed, 22 insertions(+), 19 deletions(-)

diff --git a/dartwrf/prepare_namelist.py b/dartwrf/prepare_namelist.py
index 1780db2..d762f96 100755
--- a/dartwrf/prepare_namelist.py
+++ b/dartwrf/prepare_namelist.py
@@ -57,8 +57,8 @@ def run(iens, begin, end, hist_interval_s=5*60, radt=5, archive=True,
                  '<HH2>': '%H', '<MM2>': '%M', '<SS2>': '%S'}.items():
         sed_inplace(rundir+'/namelist.input', k, end.strftime(v))
 
-    print(rundir+'/namelist.input created')
-    print('WRF namelist begin:', begin, 'end:', end, 'output to', archdir)
+    # print(rundir+'/namelist.input created')
+    # print('WRF namelist begin:', begin, 'end:', end, 'output to', archdir)
     #########################
     if archive:
         
diff --git a/dartwrf/prepare_wrfrundir.py b/dartwrf/prepare_wrfrundir.py
index 2aac5e9..434412c 100755
--- a/dartwrf/prepare_wrfrundir.py
+++ b/dartwrf/prepare_wrfrundir.py
@@ -24,12 +24,12 @@ if __name__ == '__main__':
     init_time = dt.datetime.strptime(sys.argv[1], '%Y-%m-%d_%H:%M')
 
     for iens in range(1, exp.n_ens+1):
-        print('preparing ens', iens)
+        # print('preparing ens', iens)
 
         rundir = cluster.wrf_rundir(iens)
         os.makedirs(rundir, exist_ok=True)
         link_contents(cluster.srcdir, rundir)
-        print('linking ideal and wrf.exe:')
+        # print('linking ideal and wrf.exe:')
         symlink(cluster.ideal, rundir+'/ideal.exe')
         symlink(cluster.wrfexe, rundir+'/wrf.exe')
 
@@ -41,4 +41,4 @@ if __name__ == '__main__':
             input_prof = (exp.input_profile).replace('<iens>', str(iens).zfill(3))
             symlink(input_prof, rundir+'/input_sounding')
 
-    print('finished.')
+    print('All run_WRF directories have been set up.')
diff --git a/dartwrf/workflows.py b/dartwrf/workflows.py
index ce49308..3371d2e 100644
--- a/dartwrf/workflows.py
+++ b/dartwrf/workflows.py
@@ -35,7 +35,7 @@ class WorkFlows(object):
             try:
                 shutil.copytree(self.cluster.dartwrf_dir, self.cluster.archivedir+'/DART-WRF/', 
                         ignore=shutil.ignore_patterns('*.git',))  # don't copy the git repo
-                print('DART-WRF has been copied to', self.cluster.archivedir)
+                print('>>> DART-WRF scripts:          "'+self.cluster.archivedir+'/DART-WRF/"')
             except FileExistsError as e:
                 warnings.warn(str(e))
                 if input('The experiment name already exists! Scripts will not be overwritten. Continue? (Y/n) ') in ['Y', 'y']:
@@ -91,8 +91,8 @@ class WorkFlows(object):
 
         print('------------------------------------------------------')
         print('>>> Starting experiment ... ')
-        print('>>> Experiment configuration: "./config/'+exp_config+'" ')
-        print('>>> Server configuration:     "./config/'+server_config+'"')
+        print('>>> Experiment configuration:  "./config/'+exp_config+'" ')
+        print('>>> Server configuration:      "./config/'+server_config+'"')
 
         #### 1
         # copy the selected config files (arguments to Workflows(...)) to the scripts directory
@@ -116,7 +116,19 @@ class WorkFlows(object):
         from exp_config import exp
         self.exp = exp
 
+        print('>>> Main data folder:          "'+self.cluster.archivedir+'"')
+        print('>>> Temporary DART run folder: "'+self.cluster.dart_rundir+'"')
+        print('>>> Temporary WRF run folder:  "'+self.cluster.wrf_rundir_base+'"')
+
         #### 3
+        # Set paths and backup scripts
+        self.cluster.log_dir = self.cluster.archivedir+'/logs/'
+        print('>>> In case of error, check logs at:"'+self.cluster.log_dir+'"')
+        if self.cluster.use_slurm:
+            self.cluster.slurm_scripts_dir = self.cluster.archivedir+'/slurm-scripts/'
+            print('>>> SLURM scripts stored in:    "', self.cluster.slurm_scripts_dir+'"')
+
+        #### 4
         # to be able to generate obs_seq.in files, we need a dictionary to convert obs kinds to numbers
         # a) we read the obs kind definitions (obs_kind_mod.f90 from DART code) 
         # b) we generate a python file with this dictionary
@@ -124,23 +136,14 @@ class WorkFlows(object):
         # (so the documentation generator SPHINX can read it)
         _dict_to_py(_obskind_read(), original_scripts_dir+'/obs/obskind.py')
 
-        #### 4
+        #### 5
         # Copy scripts and config files to `self.cluster.archivedir` folder
         _copy_dartwrf_to_archive() 
 
-        #### 5
+        #### 6
         # we set the path from where python should import dartwrf modules
         # every python command then imports DART-WRF from self.cluster.archivedir+'/DART-WRF/dartwrf/'
         self.cluster.python = 'export PYTHONPATH='+self.cluster.scripts_rundir+'/../; '+self.cluster.python
-
-        #### 6
-        # Set paths and backup scripts
-        self.cluster.log_dir = self.cluster.archivedir+'/logs/'
-        print('>>> Logging to:  "'+self.cluster.log_dir+'"')
-        if self.cluster.use_slurm:
-            self.cluster.slurm_scripts_dir = self.cluster.archivedir+'/slurm-scripts/'
-            print('>>> SLURM scripts stored in: "', self.cluster.slurm_scripts_dir+'"')
-
         print('>>> DART-WRF experiment initialized. ')
         print('------------------------------------------------------')
         
-- 
GitLab