Skip to content
Snippets Groups Projects
Commit 1b551cca authored by lkugler's avatar lkugler
Browse files

less printing

parent 6ba58a3e
Branches
Tags
No related merge requests found
...@@ -57,8 +57,8 @@ def run(iens, begin, end, hist_interval_s=5*60, radt=5, archive=True, ...@@ -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(): '<HH2>': '%H', '<MM2>': '%M', '<SS2>': '%S'}.items():
sed_inplace(rundir+'/namelist.input', k, end.strftime(v)) sed_inplace(rundir+'/namelist.input', k, end.strftime(v))
print(rundir+'/namelist.input created') # print(rundir+'/namelist.input created')
print('WRF namelist begin:', begin, 'end:', end, 'output to', archdir) # print('WRF namelist begin:', begin, 'end:', end, 'output to', archdir)
######################### #########################
if archive: if archive:
......
...@@ -24,12 +24,12 @@ if __name__ == '__main__': ...@@ -24,12 +24,12 @@ if __name__ == '__main__':
init_time = dt.datetime.strptime(sys.argv[1], '%Y-%m-%d_%H:%M') init_time = dt.datetime.strptime(sys.argv[1], '%Y-%m-%d_%H:%M')
for iens in range(1, exp.n_ens+1): for iens in range(1, exp.n_ens+1):
print('preparing ens', iens) # print('preparing ens', iens)
rundir = cluster.wrf_rundir(iens) rundir = cluster.wrf_rundir(iens)
os.makedirs(rundir, exist_ok=True) os.makedirs(rundir, exist_ok=True)
link_contents(cluster.srcdir, rundir) 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.ideal, rundir+'/ideal.exe')
symlink(cluster.wrfexe, rundir+'/wrf.exe') symlink(cluster.wrfexe, rundir+'/wrf.exe')
...@@ -41,4 +41,4 @@ if __name__ == '__main__': ...@@ -41,4 +41,4 @@ if __name__ == '__main__':
input_prof = (exp.input_profile).replace('<iens>', str(iens).zfill(3)) input_prof = (exp.input_profile).replace('<iens>', str(iens).zfill(3))
symlink(input_prof, rundir+'/input_sounding') symlink(input_prof, rundir+'/input_sounding')
print('finished.') print('All run_WRF directories have been set up.')
...@@ -35,7 +35,7 @@ class WorkFlows(object): ...@@ -35,7 +35,7 @@ class WorkFlows(object):
try: try:
shutil.copytree(self.cluster.dartwrf_dir, self.cluster.archivedir+'/DART-WRF/', shutil.copytree(self.cluster.dartwrf_dir, self.cluster.archivedir+'/DART-WRF/',
ignore=shutil.ignore_patterns('*.git',)) # don't copy the git repo 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: except FileExistsError as e:
warnings.warn(str(e)) warnings.warn(str(e))
if input('The experiment name already exists! Scripts will not be overwritten. Continue? (Y/n) ') in ['Y', 'y']: 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): ...@@ -91,8 +91,8 @@ class WorkFlows(object):
print('------------------------------------------------------') print('------------------------------------------------------')
print('>>> Starting experiment ... ') print('>>> Starting experiment ... ')
print('>>> Experiment configuration: "./config/'+exp_config+'" ') print('>>> Experiment configuration: "./config/'+exp_config+'" ')
print('>>> Server configuration: "./config/'+server_config+'"') print('>>> Server configuration: "./config/'+server_config+'"')
#### 1 #### 1
# copy the selected config files (arguments to Workflows(...)) to the scripts directory # copy the selected config files (arguments to Workflows(...)) to the scripts directory
...@@ -116,7 +116,19 @@ class WorkFlows(object): ...@@ -116,7 +116,19 @@ class WorkFlows(object):
from exp_config import exp from exp_config import exp
self.exp = 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 #### 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 # 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) # a) we read the obs kind definitions (obs_kind_mod.f90 from DART code)
# b) we generate a python file with this dictionary # b) we generate a python file with this dictionary
...@@ -124,23 +136,14 @@ class WorkFlows(object): ...@@ -124,23 +136,14 @@ class WorkFlows(object):
# (so the documentation generator SPHINX can read it) # (so the documentation generator SPHINX can read it)
_dict_to_py(_obskind_read(), original_scripts_dir+'/obs/obskind.py') _dict_to_py(_obskind_read(), original_scripts_dir+'/obs/obskind.py')
#### 4 #### 5
# Copy scripts and config files to `self.cluster.archivedir` folder # Copy scripts and config files to `self.cluster.archivedir` folder
_copy_dartwrf_to_archive() _copy_dartwrf_to_archive()
#### 5 #### 6
# we set the path from where python should import dartwrf modules # 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/' # 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 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('>>> DART-WRF experiment initialized. ')
print('------------------------------------------------------') print('------------------------------------------------------')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment