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

cleanup

parent 2f9cee05
No related branches found
No related tags found
No related merge requests found
...@@ -7,7 +7,7 @@ class ExperimentConfiguration(object): ...@@ -7,7 +7,7 @@ class ExperimentConfiguration(object):
pass pass
exp = ExperimentConfiguration() exp = ExperimentConfiguration()
exp.expname = "exp_v1.19_wb-random_Radar_zero" exp.expname = "exp_v1.19_Pwbub-1_WV_obs20_loc10"
exp.model_dx = 2000 exp.model_dx = 2000
exp.n_ens = 40 exp.n_ens = 40
exp.n_nodes = 10 exp.n_nodes = 10
...@@ -22,10 +22,10 @@ exp.input_profile = '/home/fs71386/lkugler/wrf_profiles/data/wrf/ens/2021-05-04/ ...@@ -22,10 +22,10 @@ exp.input_profile = '/home/fs71386/lkugler/wrf_profiles/data/wrf/ens/2021-05-04/
# localize vertically, if it has a vertical position # localize vertically, if it has a vertical position
# needs a horizontal scale too, to calculate the vertical normalization # needs a horizontal scale too, to calculate the vertical normalization
# since you can not specify different vertical localizations for diff. variables # since you can not specify different vertical localizations for diff. variables
exp.cov_loc_vert_km_horiz_km = (1, 30) exp.cov_loc_vert_km_horiz_km = (1, 10)
#exp.superob_km = 12 #exp.superob_km = 12
n_obs = 961 #5776: 4km, 121: 30km, 256:16x16 (20km); 961: 10km resoltn # radar: n_obs for each observation height level n_obs = 256 #5776: 4km, 121: 30km, 256:16x16 (20km); 961: 10km resoltn # radar: n_obs for each observation height level
vis = dict(plotname='VIS 0.6µm', plotunits='[1]', vis = dict(plotname='VIS 0.6µm', plotunits='[1]',
kind='MSG_4_SEVIRI_BDRF', sat_channel=1, n_obs=n_obs, kind='MSG_4_SEVIRI_BDRF', sat_channel=1, n_obs=n_obs,
...@@ -35,7 +35,7 @@ vis = dict(plotname='VIS 0.6µm', plotunits='[1]', ...@@ -35,7 +35,7 @@ vis = dict(plotname='VIS 0.6µm', plotunits='[1]',
wv73 = dict(plotname='Brightness temperature WV 7.3µm', plotunits='[K]', wv73 = dict(plotname='Brightness temperature WV 7.3µm', plotunits='[K]',
kind='MSG_4_SEVIRI_TB', sat_channel=6, n_obs=n_obs, kind='MSG_4_SEVIRI_TB', sat_channel=6, n_obs=n_obs,
error_generate=1., error_assimilate=False, error_generate=1., error_assimilate=False,
cov_loc_radius_km=30) cov_loc_radius_km=10)
ir108 = dict(plotname='Brightness temperature IR 10.8µm', plotunits='[K]', ir108 = dict(plotname='Brightness temperature IR 10.8µm', plotunits='[K]',
kind='MSG_4_SEVIRI_TB', sat_channel=9, n_obs=n_obs, kind='MSG_4_SEVIRI_TB', sat_channel=9, n_obs=n_obs,
...@@ -65,7 +65,7 @@ psfc = dict(plotname='SYNOP Pressure', plotunits='[dBz]', ...@@ -65,7 +65,7 @@ psfc = dict(plotname='SYNOP Pressure', plotunits='[dBz]',
cov_loc_radius_km=32) cov_loc_radius_km=32)
exp.observations = [radar] # 108, wv73, vis] exp.observations = [wv73] # 108, wv73, vis]
#exp.update_vars = ['T', 'QVAPOR', 'QCLOUD', 'QICE','CLDFRA'] #exp.update_vars = ['T', 'QVAPOR', 'QCLOUD', 'QICE','CLDFRA']
exp.update_vars = ['U', 'V', 'T', 'PH', 'MU', 'QVAPOR', 'QCLOUD', 'QICE', 'CLDFRA'] exp.update_vars = ['U', 'V', 'T', 'PH', 'MU', 'QVAPOR', 'QCLOUD', 'QICE', 'CLDFRA']
... ...
......
...@@ -21,6 +21,7 @@ def create_wrfrst_in_WRF_rundir(time, prior_init_time, prior_path_exp): ...@@ -21,6 +21,7 @@ def create_wrfrst_in_WRF_rundir(time, prior_init_time, prior_path_exp):
"""copies wrfrst to run_WRF directory (for next WRF run) """copies wrfrst to run_WRF directory (for next WRF run)
""" """
# for documentation: Which prior was used? -> write into txt file # for documentation: Which prior was used? -> write into txt file
os.makedirs(cluster.archivedir + time.strftime('/%Y-%m-%d_%H:%M/'), exist_ok=True)
os.system('echo "'+prior_path_exp+'\n'+prior_init_time.strftime('/%Y-%m-%d_%H:%M/') os.system('echo "'+prior_path_exp+'\n'+prior_init_time.strftime('/%Y-%m-%d_%H:%M/')
+'\n'+time.strftime('/wrfrst_d01_%Y-%m-%d_%H:%M:%S')+'" > ' +'\n'+time.strftime('/wrfrst_d01_%Y-%m-%d_%H:%M:%S')+'" > '
+cluster.archivedir + time.strftime('/%Y-%m-%d_%H:%M/')+'link_to_prior.txt') +cluster.archivedir + time.strftime('/%Y-%m-%d_%H:%M/')+'link_to_prior.txt')
... ...
......
...@@ -25,37 +25,33 @@ id = None ...@@ -25,37 +25,33 @@ id = None
is_nature = False is_nature = False
begin = dt.datetime(2008, 7, 30, 7) begin = dt.datetime(2008, 7, 30, 12)
id = prepare_WRFrundir(begin) # create initial conditions id = prepare_WRFrundir(begin) # create initial conditions
id = run_ideal(depends_on=id) id = run_ideal(depends_on=id)
if is_nature: if is_nature:
id = wrfinput_insert_wbubble(perturb=False, depends_on=id) #id = wrfinput_insert_wbubble(perturb=False, depends_on=id)
end = dt.datetime(2008, 7, 30, 18) end = dt.datetime(2008, 7, 30, 14)
id = run_ENS(begin=begin, end=end, id = run_ENS(begin=begin, end=end,
first_minute=False,
input_is_restart=False, input_is_restart=False,
output_restart_interval=(end-begin).total_seconds()/60, output_restart_interval=(end-begin).total_seconds()/60,
depends_on=id) depends_on=id)
id = create_satimages(begin, depends_on=id) #id = create_satimages(begin, depends_on=id)
else: else:
#id = wrfinput_insert_wbubble(perturb=True, depends_on=id) #id = wrfinput_insert_wbubble(perturb=True, depends_on=id)
restarts = pd.date_range(start=dt.datetime(2008, 7, 30, 10), restarts = pd.date_range(start=dt.datetime(2008, 7, 30, 12,30),
end=dt.datetime(2008, 7, 30, 12), end=dt.datetime(2008, 7, 30, 13),
freq=dt.timedelta(minutes=60)) freq=dt.timedelta(minutes=30))
#restarts = [dt.datetime(2008, 7, 30, 11)] #restarts = [dt.datetime(2008, 7, 30, 11)]
input_is_restart = False input_is_restart = False
time = begin time = begin
last_init = dt.datetime(2008, 7, 30, 9) # dummy value last_init = dt.datetime(2008, 7, 30, 9) # dummy value
for next_restart in restarts: for i, next_restart in enumerate(restarts):
print('run_WRF from', time, 'to', next_restart) print('run_WRF from', time, 'to', next_restart)
id = run_ENS(begin=time, end=next_restart, id = run_ENS(begin=time, end=next_restart,
first_minute=False,
input_is_restart=input_is_restart, input_is_restart=input_is_restart,
restart_path=cluster.archivedir+last_init.strftime('/%Y-%m-%d_%H:%M/'),
output_restart_interval=(next_restart-time).total_seconds()/60, output_restart_interval=(next_restart-time).total_seconds()/60,
#output_restart_interval=720, #output_restart_interval=720,
depends_on=id) depends_on=id)
...@@ -63,21 +59,24 @@ else: ...@@ -63,21 +59,24 @@ else:
last_init = time last_init = time
time = next_restart time = next_restart
input_is_restart = True input_is_restart = True
create_satimages(last_init, depends_on=id) #create_satimages(last_init, depends_on=id)
prior_path_exp = cluster.archivedir
prior_init_time = last_init
prior_valid_time = time
id = prepare_IC_from_prior(prior_path_exp, prior_init_time, prior_valid_time, depends_on=id)
#sys.exit() #sys.exit()
# free run, no restart files anymore # free run, no restart files anymore
end = dt.datetime(2008, 7, 30, 14)
print('run WRF from', time, 'until', end) print('run WRF from', time, 'until', end)
end = dt.datetime(2008, 7, 30, 18)
id = run_ENS(begin=time, end=end, id = run_ENS(begin=time, end=end,
first_minute=False,
input_is_restart=input_is_restart, input_is_restart=input_is_restart,
restart_path=cluster.archivedir+time.strftime('/%Y-%m-%d_%H:%M/'),
#output_restart_interval=(next_restart-time).total_seconds()/60, #output_restart_interval=(next_restart-time).total_seconds()/60,
output_restart_interval=9999, output_restart_interval=9999,
depends_on=id) depends_on=id)
id = create_satimages(time, depends_on=id) #id = create_satimages(time, depends_on=id)
verify(depends_on=id) verify(depends_on=id)
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
high level control script high level control script
submitting jobs into SLURM queue submitting jobs into SLURM queue
""" """
import os, sys, shutil, glob import os, sys, shutil, glob, warnings
import datetime as dt import datetime as dt
from slurmpy import Slurm from slurmpy import Slurm
...@@ -86,12 +86,6 @@ def run_ENS(begin, end, depends_on=None, first_minute=True, ...@@ -86,12 +86,6 @@ def run_ENS(begin, end, depends_on=None, first_minute=True,
Then run whole timespan with 5 minutes interval. Then run whole timespan with 5 minutes interval.
if input_is_restart: # start WRF in restart mode if input_is_restart: # start WRF in restart mode
if restart_path:
# restart from a wrfrst file in restart_path directory
# e.g. when restarting from a state in an archivedir (from any existing experiment)
else:
# restart from wrfrst files that are already in run_WRF directories
# e.g. after updateIC, it puts wrfrst in run_WRF directories
""" """
id = depends_on id = depends_on
restart_flag = '.false.' if not input_is_restart else '.true.' restart_flag = '.false.' if not input_is_restart else '.true.'
...@@ -108,8 +102,6 @@ def run_ENS(begin, end, depends_on=None, first_minute=True, ...@@ -108,8 +102,6 @@ def run_ENS(begin, end, depends_on=None, first_minute=True,
# str(hist_interval), # str(hist_interval),
# '--radt='+str(radt), # '--radt='+str(radt),
# '--restart='+restart_flag,] # '--restart='+restart_flag,]
# if restart_path: # restart from a wrfrst file in restart_path directory
# args.append('--rst_inname='+restart_path)
# id = s.run(' '.join(args), depends_on=[id]) # id = s.run(' '.join(args), depends_on=[id])
# s = my_Slurm("runWRF1", cfg_update={"nodes": "1", "array": "1-"+str(exp.n_nodes), # s = my_Slurm("runWRF1", cfg_update={"nodes": "1", "array": "1-"+str(exp.n_nodes),
...@@ -134,8 +126,6 @@ def run_ENS(begin, end, depends_on=None, first_minute=True, ...@@ -134,8 +126,6 @@ def run_ENS(begin, end, depends_on=None, first_minute=True,
str(hist_interval), str(hist_interval),
'--radt='+str(radt), '--radt='+str(radt),
'--restart='+restart_flag,] '--restart='+restart_flag,]
# if restart_path:
# args.append('--rst_inname='+restart_path)
if output_restart_interval: if output_restart_interval:
args.append('--restart_interval='+str(int(float(output_restart_interval)))) args.append('--restart_interval='+str(int(float(output_restart_interval))))
...@@ -235,20 +225,19 @@ if __name__ == "__main__": ...@@ -235,20 +225,19 @@ if __name__ == "__main__":
id = None id = None
init_time = dt.datetime(2008, 7, 30, 12) init_time = dt.datetime(2008, 7, 30, 12)
time = dt.datetime(2008, 7, 30, 13) time = dt.datetime(2008, 7, 30, 12,30)
id = prepare_WRFrundir(init_time) id = prepare_WRFrundir(init_time)
#id = run_ideal(depends_on=id)
#prior_path_exp = cluster.archivedir # #prior_path_exp = cluster.archivedir #
#prior_path_exp = '/gpfs/data/fs71386/lkugler/sim_archive/exp_v1.18_Pwbub-1-ensprof_40mem_rst' prior_path_exp = '/gpfs/data/fs71386/lkugler/sim_archive/exp_v1.19_Pwbub5_40mem'
prior_path_exp = '/gpfs/data/fs71386/lkugler/sim_archive/exp_v1.19_P1_noDA'
#id = wrfinput_insert_wbubble(depends_on=id) #id = wrfinput_insert_wbubble(depends_on=id)
prior_init_time = init_time prior_init_time = init_time
prior_valid_time = time prior_valid_time = time
id = prepare_IC_from_prior(prior_path_exp, prior_init_time, prior_valid_time, depends_on=id)
while time <= dt.datetime(2008, 7, 30, 14): while time <= dt.datetime(2008, 7, 30, 13,30):
# usually we take the prior from the current time # usually we take the prior from the current time
# but one could use a prior from a different time from another run # but one could use a prior from a different time from another run
...@@ -265,13 +254,12 @@ if __name__ == "__main__": ...@@ -265,13 +254,12 @@ if __name__ == "__main__":
# How long shall we integrate? # How long shall we integrate?
timedelta_integrate = timedelta_btw_assim timedelta_integrate = timedelta_btw_assim
if time == dt.datetime(2008, 7, 30, 14): #this_forecast_init.minute in [0,]: # longer forecast every full hour if time == dt.datetime(2008, 7, 30, 13,30): #this_forecast_init.minute in [0,]: # longer forecast every full hour
timedelta_integrate = dt.timedelta(hours=1) timedelta_integrate = dt.timedelta(hours=2)
# 3) Run WRF ensemble # 3) Run WRF ensemble
id = run_ENS(begin=time, # start integration from here id = run_ENS(begin=time, # start integration from here
end=time + timedelta_integrate, # integrate until here end=time + timedelta_integrate, # integrate until here
restart_path=cluster.archivedir+prior_init_time.strftime('/%Y-%m-%d_%H:%M/'),
output_restart_interval=timedelta_btw_assim.total_seconds()/60, output_restart_interval=timedelta_btw_assim.total_seconds()/60,
depends_on=id) depends_on=id)
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment