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

updating from master

parent a6ada136
No related branches found
No related tags found
No related merge requests found
...@@ -15,13 +15,17 @@ from dartwrf.server_config import cluster ...@@ -15,13 +15,17 @@ from dartwrf.server_config import cluster
wrfout_format = 'wrfout_d01_%Y-%m-%d_%H:%M:%S' wrfout_format = 'wrfout_d01_%Y-%m-%d_%H:%M:%S'
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.
Args: symlink(cluster.dartrundir + "/prior_ens1/wrfout_d01",
time (dt.datetime): Time at which observations will be made cluster.dartrundir + "/wrfinput_d01")
def _copy_nature_to_dart(time):
"""Copies wrfout_d01 from nature run to DART directory
TODO: This is a bit of a hack, because it is not explicit about where to take the nature from.
""" """
# get wrfout_d01 from nature run
# find the file in any init directory # find the file in any init directory
fformat = 'wrfout_d01_%Y-%m-%d_%H:%M:%S' fformat = 'wrfout_d01_%Y-%m-%d_%H:%M:%S'
f_nat = glob.glob(cluster.archive_base + '/' + exp.nature_expname + '/*/1/'+time.strftime(fformat))[0] f_nat = glob.glob(cluster.archive_base + '/' + exp.nature_expname + '/*/1/'+time.strftime(fformat))[0]
...@@ -33,16 +37,24 @@ def link_nature_to_dart_truth(time): ...@@ -33,16 +37,24 @@ def link_nature_to_dart_truth(time):
print("linked", f_nat, "to", cluster.dart_rundir + "/wrfout_d01") print("linked", f_nat, "to", cluster.dart_rundir + "/wrfout_d01")
f_wrfout_nature = time.strftime(exp.nature+'/'+wrfout_format) f_wrfout_nature = time.strftime(exp.nature+'/'+wrfout_format)
if os.path.exists(f_wrfout_nature): assert os.path.exists(f_wrfout_nature)
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")
if cluster.geo_em_for_WRF_ideal:
wrfout_add_geo.run(cluster.geo_em_for_WRF_ideal, cluster.dart_rundir + "/wrfout_d01")
else: # if nature is not available due to any reason print("linking nature to DART & georeferencing")
print('-> has no nature, not copying nature') shutil.copy(f_wrfout_nature, cluster.dartrundir + "/wrfout_d01")
print("linked", f_wrfout_nature, "to", cluster.dartrundir + "/wrfout_d01")
if cluster.geo_em_for_WRF_ideal:
wrfout_add_geo.run(cluster.geo_em_for_WRF_ideal, cluster.dart_rundir + "/wrfout_d01")
def prepare_nature_dart(time):
"""Prepares DART nature (wrfout_d01) if available
Args:
time (dt.datetime): Time at which observations will be made
"""
try:
_copy_nature_to_dart(time)
except FileExistsError: # if nature is not available due to any reason
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):
...@@ -119,6 +131,8 @@ def write_list_of_outputfiles(): ...@@ -119,6 +131,8 @@ def write_list_of_outputfiles():
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.dart_rundir) os.chdir(cluster.dart_rundir)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment