From 57ff4b1fcc333014773c7bb8c3a9c5d23494faf4 Mon Sep 17 00:00:00 2001 From: Lukas Kugler <lukas.kugler@univie.ac.at> Date: Fri, 14 Feb 2025 11:32:19 +0100 Subject: [PATCH] minor changes --- config/jet.py | 6 ++-- dartwrf/prepare_namelist.py | 2 +- multiple_exps.py | 57 +++++++++++++++++++------------------ tests/test_assim.py | 2 +- 4 files changed, 35 insertions(+), 32 deletions(-) diff --git a/config/jet.py b/config/jet.py index 4f06715..ed06145 100755 --- a/config/jet.py +++ b/config/jet.py @@ -1,8 +1,8 @@ """Cluster configuration file, see docstring of ClusterConfig class in dartwrf/utils.py for details""" cluster_defaults = dict( - max_nproc = 16, - max_nproc_for_each_ensemble_member = 9, + max_nproc = 20, + max_nproc_for_each_ensemble_member = 16, use_slurm = True, # binaries @@ -33,7 +33,7 @@ cluster_defaults = dict( WRF_exe_template = '/jetfs/home/lkugler/DART-WRF/templates/run_WRF.jet.sh', WRF_ideal_template = '/jetfs/home/lkugler/DART-WRF/templates/run_WRF_ideal.sh', - slurm_kwargs = {"account": "lkugler", "partition": "hub", + slurm_kwargs = {"account": "lkugler", "partition": "all", "time": "00:30:00", "ntasks": "1", "ntasks-per-core": "1", "mem": "30G", "mail-type": "FAIL", "mail-user": "lukas.kugler@univie.ac.at"}, diff --git a/dartwrf/prepare_namelist.py b/dartwrf/prepare_namelist.py index 6b6f623..a379854 100755 --- a/dartwrf/prepare_namelist.py +++ b/dartwrf/prepare_namelist.py @@ -79,7 +79,7 @@ def run(cfg: Config) -> None: try_remove(f_out) nml.write(f_out) - print('saved', f_out) + #print('saved', f_out) # copy to archive init = start.strftime('/%Y-%m-%d_%H:%M/') diff --git a/multiple_exps.py b/multiple_exps.py index 3a43b32..44019cf 100644 --- a/multiple_exps.py +++ b/multiple_exps.py @@ -10,30 +10,29 @@ from config.defaults import dart_nml # test multiple assimilation windows (11-12, 12-13, 13-14, ) timedelta_btw_assim = dt.timedelta(minutes=15) -assim_times_start = pd.date_range('2008-07-30 11:00', '2008-07-30 13:00', freq='h') +assim_times_start = pd.date_range('2008-07-30 11:00', '2008-07-30 13:00', freq='1h') +ensemble_size = 40 -for t0 in assim_times_start: +dart_nml['&filter_nml'].update(num_output_state_members=ensemble_size, + ens_size=ensemble_size) + +vis = dict( + kind='MSG_4_SEVIRI_BDRF', sat_channel=1, + km_between_obs=12, skip_border_km=8.0, + error_generate=0.03, error_assimilate=0.06, + loc_horiz_km=20, + height=6000, loc_vert_km=6, + ) +for t0 in assim_times_start: id = None - ensemble_size = 3 - - dart_nml['&filter_nml'].update(num_output_state_members=ensemble_size, - ens_size=ensemble_size) - - t_raso = dict(var_name='Temperature', unit='[K]', - kind='RADIOSONDE_TEMPERATURE', - obs_locations=[(45., 0.)], - error_generate=0.2, error_assimilate=0.6, - heights=range(1000, 15001, 500), - loc_horiz_km=100, loc_vert_km=3) - - cfg = Config(name='test_exp', + cfg = Config(name=t0.strftime('exp_nat250_VIS_obs12_loc20_oe2_inf4-0.5_%H%M'), model_dx = 2000, ensemble_size = ensemble_size, dart_nml = dart_nml, geo_em_forecast = '/jetfs/home/lkugler/data/sim_archive/geo_em.d01.nc.2km_200x200', - time = dt.datetime(2008, 7, 30, 11), + time = t0, use_existing_obsseq = False, nature_wrfout_pattern = '/jetfs/home/lkugler/data/sim_archive/nat_250m_1600x1600x100/*/1/wrfout_d01_%Y-%m-%d_%H_%M_%S', @@ -43,30 +42,30 @@ for t0 in assim_times_start: update_vars = ['U', 'V', 'W', 'THM', 'PH', 'MU', 'QVAPOR', 'QCLOUD', 'QICE', 'QSNOW', 'PSFC'], input_profile = '/jetfs/home/lkugler/data/sim_archive/nat_250m_1600x1600x100/2008-07-30_08:00/1/input_sounding', nature_exp_verif = 'nat_250m_blockavg2km', - assimilate_these_observations = [t_raso,], + assimilate_these_observations = [vis,], **cluster_defaults, # type: ignore ) - # test multiple assimilation windows (11-12, 12-13, 13-14, ) - timedelta_btw_assim = dt.timedelta(minutes=15) - #pd.date_range('2008-07-30 11:00', '2008-07-30 13:00', freq='h') - - w = WorkFlows(cfg) w.prepare_WRFrundir(cfg) #id = w.run_ideal(cfg, depends_on=id) # assimilate at these times time0 = cfg.time - assim_times = pd.date_range(time0, time0 + timedelta_btw_assim, freq=timedelta_btw_assim) + assim_times = pd.date_range(time0, time0 + dt.timedelta(hours=1), freq=timedelta_btw_assim) last_assim_time = assim_times[-1] # loop over assimilations for i, t in enumerate(assim_times): if i == 0: + if t == dt.datetime(2008, 7, 30, 11): + prior_init_time = dt.datetime(2008, 7, 30, 8) + else: + prior_init_time = t - dt.timedelta(minutes=15) + cfg.update(time = t, - prior_init_time = dt.datetime(2008, 7, 30, 8), + prior_init_time = prior_init_time, prior_valid_time = t, prior_path_exp = '/jetfs/home/lkugler/data/sim_archive/exp_nat250m_noDA/',) else: @@ -84,13 +83,17 @@ for t0 in assim_times_start: # 2) Update posterior += updates from assimilation id = w.update_IC_from_DA(cfg, depends_on=id) - # How long shall we integrate? - timedelta_integrate = dt.timedelta(minutes=5) + if t == last_assim_time: + restart_interval = 9999 + timedelta_integrate = dt.timedelta(hours=4) + else: + restart_interval = timedelta_btw_assim.total_seconds()/60 # in minutes + timedelta_integrate = dt.timedelta(minutes=15) cfg.update( WRF_start=t, WRF_end=t+timedelta_integrate, restart=True, - restart_interval=9999, + restart_interval=restart_interval, hist_interval_s=300, ) diff --git a/tests/test_assim.py b/tests/test_assim.py index 5a3d551..875d670 100644 --- a/tests/test_assim.py +++ b/tests/test_assim.py @@ -17,7 +17,7 @@ def test_dartwrf_cycled_da(): dart_nml['&filter_nml'].update(num_output_state_members=ensemble_size, ens_size=ensemble_size) - + t_raso = dict(var_name='Temperature', unit='[K]', kind='RADIOSONDE_TEMPERATURE', obs_locations=[(45., 0.)], -- GitLab