From 6ba58a3e3b905a28ffcdb5d871d148c9b8d7eee8 Mon Sep 17 00:00:00 2001 From: lkugler <lukas.kugler@gmail.com> Date: Tue, 28 May 2024 21:08:45 +0200 Subject: [PATCH] related to wrfinput fix --- dartwrf/evaluate_obs_space.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/dartwrf/evaluate_obs_space.py b/dartwrf/evaluate_obs_space.py index 7f39385..7c6a1ee 100755 --- a/dartwrf/evaluate_obs_space.py +++ b/dartwrf/evaluate_obs_space.py @@ -23,15 +23,23 @@ def evaluate_one_time(assim_time, valid_time, use_other_obsseq=False): # does an observation exist at this time? f_oso = valid_time.strftime(aso.pattern_obs_seq_out) - f_oso = cluster.archivedir+valid_time.strftime("/obs_seq_out/%Y-%m-%d_%H:%M:%S_obs_seq.out") + f_oso = cluster.archivedir+valid_time.strftime("/%Y-%m-%d_%H:%M_obs_seq.out") if os.path.exists(f_oso): # use the existing file shutil.copy(f_oso, cluster.dart_rundir+'/obs_seq.out') else: - if False: + try: + # generate the observations for the specified valid_time + aso.prepare_nature_dart(valid_time) + osq_out.generate_obsseq_out(valid_time) + except: + print("failed to generate observations from a nature file") + print("-> trying to evaluate posterior with dummy observations") # use an old obsseq file and overwrite obs/truth values with "missing value" - f_oso = cluster.archivedir+valid_time.strftime("/obs_seq_out/%Y-%m-%d_%H:%M_obs_seq.out") + f_oso = cluster.archivedir+valid_time.strftime("/diagnostics/%Y-%m-%d_%H:%M_obs_seq.out") + if not os.path.isfile(f_oso): + raise RuntimeError(f_oso+' not found. Cannot create dummy observation.') from dartwrf.obs import obsseq oso = obsseq.ObsSeq(f_oso) @@ -40,10 +48,6 @@ def evaluate_one_time(assim_time, valid_time, use_other_obsseq=False): oso.df['observations'] = -888888.0 oso.df['truth'] = -888888.0 oso.to_dart(cluster.dart_rundir+'/obs_seq.out') - else: - # generate the observations for the specified valid_time - aso.prepare_nature_dart(valid_time) - osq_out.generate_obsseq_out(valid_time) aso.evaluate(valid_time, f_out_pattern=cluster.archivedir + "/diagnostics/%Y-%m-%d_%H:%M:%S_obs_seq.final-evaluate") -- GitLab