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

nature wrfinput_d01 fix

parent abc1a587
No related branches found
No related tags found
1 merge request!5Forward to most current stage
...@@ -78,31 +78,32 @@ def set_DART_nml(just_prior_values=False): ...@@ -78,31 +78,32 @@ def set_DART_nml(just_prior_values=False):
append_file(cluster.dartrundir + "/input.nml", rttov_nml) append_file(cluster.dartrundir + "/input.nml", rttov_nml)
def link_nature_to_dart_truth(time): def _prepare_DART_grid_template():
"""Set a symlink from the WRFout file to be used as nature to the run_DART folder # DART needs a wrfinput file as a template for the grid
# No data will be read from this file, but the grid information must match exactly.
symlink(cluster.dartrundir + "/prior_ens1/wrfout_d01",
cluster.dartrundir + "/wrfinput_d01")
def prepare_nature_dart(time):
"""Prepares DART nature (wrfout_d01) if available
Args: Args:
time (dt.datetime): Time at which observations will be made time (dt.datetime): Time at which observations will be made
""" """
# get wrfout_d01 from nature run try:
shutil.copy(time.strftime(exp.nature+'/'+wrfout_format), f_wrfout_nature = time.strftime(exp.nature+'/'+wrfout_format)
cluster.dartrundir + "/wrfout_d01") os.path.exists(f_wrfout_nature)
except: # if nature is not available due to any reason
# DART may need a wrfinput file as well, which serves as a template for dimension sizes print('-> has no nature, not copying nature')
symlink(cluster.dartrundir + "/wrfout_d01", return
cluster.dartrundir + "/wrfinput_d01")
print("linked", time.strftime(exp.nature+'/'+wrfout_format),
"to", cluster.dartrundir + "/wrfout_d01")
print("linking nature to DART & georeferencing")
shutil.copy(f_wrfout_nature, cluster.dartrundir + "/wrfout_d01")
print("linked", f_wrfout_nature, "to", cluster.dartrundir + "/wrfout_d01")
def prepare_nature_dart(time): wrfout_add_geo.run(cluster.geo_em, cluster.dartrundir + "/wrfout_d01")
if hasattr(exp, 'nature'):
print("linking nature to DART & georeferencing")
link_nature_to_dart_truth(time)
wrfout_add_geo.run(cluster.geo_em, cluster.dartrundir + "/wrfout_d01")
else:
print('has no nature, not copying nature')
def prepare_prior_ensemble(assim_time, prior_init_time, prior_valid_time, prior_path_exp): def prepare_prior_ensemble(assim_time, prior_init_time, prior_valid_time, prior_path_exp):
...@@ -186,6 +187,8 @@ def run_perfect_model_obs(nproc=12, verbose=True): ...@@ -186,6 +187,8 @@ def run_perfect_model_obs(nproc=12, verbose=True):
"\n look for " + cluster.dartrundir + "/log.perfect_model_obs") "\n look for " + cluster.dartrundir + "/log.perfect_model_obs")
def filter(nproc=12): def filter(nproc=12):
_prepare_DART_grid_template()
print("time now", dt.datetime.now()) print("time now", dt.datetime.now())
print("running filter") print("running filter")
os.chdir(cluster.dartrundir) os.chdir(cluster.dartrundir)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment