From 52d2717837e96e00f093849eafe54e5fd66e944b Mon Sep 17 00:00:00 2001 From: lkugler <lukas.kugler@gmail.com> Date: Wed, 24 May 2023 21:55:02 +0200 Subject: [PATCH] change from nature_wrfout to nature_expname --- config/exp_template.py | 3 +-- dartwrf/assim_synth_obs.py | 14 +++++++------- dartwrf/dart_nml.py | 22 +++++++++++----------- free_forecast.py | 1 + 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/config/exp_template.py b/config/exp_template.py index 71650ab..37b4a15 100755 --- a/config/exp_template.py +++ b/config/exp_template.py @@ -9,8 +9,7 @@ exp.superob_km = False # False or int (spatial averaging of observations, unit: exp.use_existing_obsseq = False # False or pathname (use precomputed obs_seq.out files) #exp.use_existing_obsseq = '/users/students/lehre/advDA_s2023/dartwrf_tutorial/very_cold_observation.out' -# path to the nature run, where we take observations from -exp.nature_wrfout = '/mnt/jetfs/scratch/lkugler/data/sim_archive/exp_v1.18_P1_nature/2008-07-30_06:00/1/wrfout_d01_%Y-%m-%d_%H:%M:%S' +exp.nature_expname = 'exp_v1.18_P1_nature+1' exp.input_profile = '/mnt/jetfs/home/lkugler/data/initial_profiles/wrf/ens/2022-03-31/raso.fc.<iens>.wrfprof' diff --git a/dartwrf/assim_synth_obs.py b/dartwrf/assim_synth_obs.py index f3cdace..a23f804 100755 --- a/dartwrf/assim_synth_obs.py +++ b/dartwrf/assim_synth_obs.py @@ -1,4 +1,4 @@ -import os, sys, shutil, warnings +import os, sys, shutil, warnings, glob import time as time_module import datetime as dt import numpy as np @@ -21,16 +21,16 @@ def link_nature_to_dart_truth(time): Args: time (dt.datetime): Time at which observations will be made """ - # get wrfout_d01 from nature run - shutil.copy(time.strftime(exp.nature_wrfout), - cluster.dart_rundir + "/wrfout_d01") + # find the file in any init directory + fformat = 'wrfout_d01_%Y-%m-%d_%H:%M:%S' + f_nat = glob.glob(cluster.archive_base + '/' + exp.nature_expname + '/*/1/'+time.strftime(fformat))[0] + shutil.copy(f_nat, cluster.dart_rundir + "/wrfout_d01") - # DART may need a wrfinput file as well, which serves as a template for dimension sizes + # DART may need a wrfinput file as well ?! symlink(cluster.dart_rundir + "/wrfout_d01", cluster.dart_rundir + "/wrfinput_d01") - print("linked", time.strftime(exp.nature_wrfout), - "to", cluster.dart_rundir + "/wrfout_d01") + print("linked", f_nat, "to", cluster.dart_rundir + "/wrfout_d01") def prepare_nature_dart(time): diff --git a/dartwrf/dart_nml.py b/dartwrf/dart_nml.py index 0792353..84a2412 100644 --- a/dartwrf/dart_nml.py +++ b/dartwrf/dart_nml.py @@ -280,9 +280,6 @@ def write_namelist(just_prior_values=False): list_obstypes, list_loc_horiz_rad, list_loc_vert_km, list_loc_vert_scaleheight = _get_list_of_localizations() nml = read_namelist(cluster.dart_srcdir + "/input.nml") - - # make sure that observations defined in `exp.observations` are assimilated - nml['&obs_kind_nml']['assimilate_these_obs_types'] = [list_obstypes] # dont compute posterior, just evaluate prior if just_prior_values: @@ -293,17 +290,20 @@ def write_namelist(just_prior_values=False): nml['&obs_kind_nml']['assimilate_these_obs_types'] = [[]] nml['&obs_kind_nml']['evaluate_these_obs_types'] = [list_obstypes] + if len(list_obstypes) > 0: + # make sure that observations defined in `exp.observations` are assimilated + nml['&obs_kind_nml']['assimilate_these_obs_types'] = [list_obstypes] - # write localization variables - nml['&assim_tools_nml']['special_localization_obs_types'] = [list_obstypes] - nml['&assim_tools_nml']['special_localization_cutoffs'] = [list_loc_horiz_rad] + # write localization variables + nml['&assim_tools_nml']['special_localization_obs_types'] = [list_obstypes] + nml['&assim_tools_nml']['special_localization_cutoffs'] = [list_loc_horiz_rad] - nml['&location_nml']['special_vert_normalization_obs_types'] = [list_obstypes] - nml['&location_nml']['special_vert_normalization_heights'] = [list_loc_vert_km] - nml['&location_nml']['special_vert_normalization_scale_heights'] = [list_loc_vert_scaleheight] + nml['&location_nml']['special_vert_normalization_obs_types'] = [list_obstypes] + nml['&location_nml']['special_vert_normalization_heights'] = [list_loc_vert_km] + nml['&location_nml']['special_vert_normalization_scale_heights'] = [list_loc_vert_scaleheight] - nml['&location_nml']['special_vert_normalization_levels'] = [[-1,]] - nml['&location_nml']['special_vert_normalization_pressures'] = [[-1,]] + nml['&location_nml']['special_vert_normalization_levels'] = [[-1,]] + nml['&location_nml']['special_vert_normalization_pressures'] = [[-1,]] # overwrite namelist parameters as defined in the experiment configuration for section, sdata in exp.dart_nml.items(): diff --git a/free_forecast.py b/free_forecast.py index 8106192..1485c29 100755 --- a/free_forecast.py +++ b/free_forecast.py @@ -49,6 +49,7 @@ if True: # to continue a nature depends_on=id) # integration time + start = time end = next_restart id = w.run_ENS(begin=start, end=end, -- GitLab