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

evaluate also after filter to include effect of clamping

parent d1f8862c
No related branches found
No related tags found
No related merge requests found
...@@ -285,8 +285,11 @@ def qc_obs(time, oso): ...@@ -285,8 +285,11 @@ def qc_obs(time, oso):
print('saved', f_out_dart) print('saved', f_out_dart)
def evaluate(assim_time, obs_seq_out=False, def evaluate(assim_time,
output_format="%Y-%m-%d_%H:%M_obs_seq.final-eval_posterior_allobs"): obs_seq_out=False,
prior=True,
posterior=False,
output_format="%Y-%m-%d_%H:%M_obs_seq.final-evaluate"):
"""Calculates either prior or posterior obs space values. """Calculates either prior or posterior obs space values.
Note: Depends on a prepared input_list.txt, which defines the ensemble (prior or posterior). Note: Depends on a prepared input_list.txt, which defines the ensemble (prior or posterior).
...@@ -301,6 +304,8 @@ def evaluate(assim_time, obs_seq_out=False, ...@@ -301,6 +304,8 @@ def evaluate(assim_time, obs_seq_out=False,
Returns: Returns:
obsseq.ObsSeq obsseq.ObsSeq
""" """
if prior == posterior:
raise ValueError('either prior or posterior must be True, the other must be False')
os.makedirs(cluster.dart_rundir, exist_ok=True) # create directory to run DART in os.makedirs(cluster.dart_rundir, exist_ok=True) # create directory to run DART in
os.chdir(cluster.dart_rundir) os.chdir(cluster.dart_rundir)
...@@ -313,6 +318,11 @@ def evaluate(assim_time, obs_seq_out=False, ...@@ -313,6 +318,11 @@ def evaluate(assim_time, obs_seq_out=False,
print("prepare nature") print("prepare nature")
prepare_nature_dart(assim_time) # link WRF files to DART directory prepare_nature_dart(assim_time) # link WRF files to DART directory
if posterior:
write_list_of_inputfiles_posterior(time)
if prior:
write_list_of_inputfiles_prior()
if obs_seq_out: if obs_seq_out:
copy(obs_seq_out, cluster.dart_rundir+'/obs_seq.out') copy(obs_seq_out, cluster.dart_rundir+'/obs_seq.out')
else: else:
...@@ -490,19 +500,20 @@ def main(time, prior_init_time, prior_valid_time, prior_path_exp): ...@@ -490,19 +500,20 @@ def main(time, prior_init_time, prior_valid_time, prior_path_exp):
# is any observation error parametrized? # is any observation error parametrized?
if any(error_is_parametrized) or do_QC: if any(error_is_parametrized) or do_QC:
print(" (optional) evaluate prior for all observations (incl rejected) ") print(" (optional) evaluate prior for all observations (incl rejected) ")
evaluate(time, output_format="%Y-%m-%d_%H:%M_obs_seq.final-eval_prior_allobs") evaluate(time, prior=True,
output_format="%Y-%m-%d_%H:%M_obs_seq.final-evaluate_prior")
print(" assign observation-errors for assimilation ") print(" assign observation-errors for assimilation ")
set_obserr_assimilate_in_obsseqout(oso, outfile=cluster.dart_rundir + "/obs_seq.out") set_obserr_assimilate_in_obsseqout(oso, outfile=cluster.dart_rundir + "/obs_seq.out")
if do_QC: if do_QC:
print(" 2.3) reject observations? ") print(" reject observations? ")
qc_obs(time, oso) qc_obs(time, oso)
if prior_inflation_type == '2': if prior_inflation_type == '2':
prepare_inflation_2(time, prior_init_time) prepare_inflation_2(time, prior_init_time)
print(" 3) run filter ") print(" run filter ")
dart_nml.write_namelist() dart_nml.write_namelist()
filter(nproc=nproc) filter(nproc=nproc)
archive_filteroutput(time) archive_filteroutput(time)
...@@ -510,12 +521,16 @@ def main(time, prior_init_time, prior_valid_time, prior_path_exp): ...@@ -510,12 +521,16 @@ def main(time, prior_init_time, prior_valid_time, prior_path_exp):
if prior_inflation_type == '2': if prior_inflation_type == '2':
archive_inflation_2(time) archive_inflation_2(time)
print(" evaluate posterior in observation-space")
if do_QC: if do_QC:
print(" 4) evaluate posterior observations for all observations (incl rejected)") f_oso = '%Y-%m-%d_%H:%M_obs_seq.out-beforeQC' # includes all observations (including rejected ones in qc_obs())
write_list_of_inputfiles_posterior(time) else:
f_oso = '%Y-%m-%d_%H:%M_obs_seq.out'
evaluate(time, obs_seq_out=cluster.archivedir+'/obs_seq_out/'+time.strftime('%Y-%m-%d_%H:%M_obs_seq.out-beforeQC'), # evaluate() separately after ./filter is crucial when assimilating cloud variables
output_format="%Y-%m-%d_%H:%M_obs_seq.final-eval_posterior_allobs") # as the obs_seq.final returned by ./filter was produced using un-clamped cloud variables
evaluate(time, obs_seq_out=cluster.archivedir+'/obs_seq_out/'+time.strftime(f_oso),
prior=False, posterior=True,
output_format="%Y-%m-%d_%H:%M_obs_seq.final-evaluate_posterior")
if __name__ == "__main__": if __name__ == "__main__":
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment