Skip to content
Snippets Groups Projects
Commit 19366729 authored by Lukas Kugler's avatar Lukas Kugler
Browse files

consistent config from cfg.py

parent 30984be1
No related branches found
No related tags found
No related merge requests found
...@@ -91,46 +91,44 @@ def set_input_nml(sat_channel=False, just_prior_values=False): ...@@ -91,46 +91,44 @@ def set_input_nml(sat_channel=False, just_prior_values=False):
if __name__ == "__main__": if __name__ == "__main__":
time = dt.datetime.strptime(sys.argv[1], '%Y-%m-%d_%H:%M') time = dt.datetime.strptime(sys.argv[1], '%Y-%m-%d_%H:%M')
print(dt.datetime.now())
# error_var = (5.)**2
# kind = 'RADAR'
# error_var = (0.5)**2
# kind = 'RASO_T'
#obs.generic_obs(kind, time, exp.n_obs, exp.radar_err**2, exp.distance_between_obs_meters, # remove any existing observation files
# output_path=cluster.dartrundir, os.system('rm -f 'cluster.dartrundir+'/obs_seq_*.out')
# fpath_obs_locations=cluster.archivedir()+time.strftime('/%Y-%m-%d_%H:%M')
# +'/obs_coords.pkl')
for i_obs, obscfg in enumerate(exp.observations):
for channel_id in exp.sat_channels: n_obs = obscfg['n_obs']
error_var = (obscfg['err_std'])**2
distance_between_obs_meters = obscfg['distance_between_obs_meters']
n_obs = 100 # generate obs_seq.in
channel_id = 6 if not obscfg['sat']:
distance_between_obs_meters = 10000 create_obsseq.generic_obs(obscfg['kind'], time, n_obs, error_var,
distance_between_obs_meters,
error_var = (1.)**2 output_path=cluster.dartrundir,
create_obsseq.sat(time, channel_id, n_obs, error_var, fpath_obs_locations=cluster.archivedir()+time.strftime('/%Y-%m-%d_%H:%M')
+'/obs_coords.pkl')
else:
create_obsseq.sat(time, obscfg['channel'], n_obs, error_var,
distance_between_obs_meters, distance_between_obs_meters,
output_path=cluster.dartrundir, output_path=cluster.dartrundir,
fpath_obs_locations='./domain.pkl') fpath_obs_locations='./domain.pkl')
print(dt.datetime.now())
if not os.path.exists(cluster.dartrundir+'/obs_seq.in'): if not os.path.exists(cluster.dartrundir+'/obs_seq.in'):
raise RuntimeError('obs_seq.in does not exist in '+cluster.dartrundir) raise RuntimeError('obs_seq.in does not exist in '+cluster.dartrundir)
# generate observations # generate observations (obs_seq.out)
set_input_nml(sat_channel=channel_id, just_prior_values=True) set_input_nml(sat_channel=channel_id, just_prior_values=True)
os.chdir(cluster.dartrundir) os.chdir(cluster.dartrundir)
t = dt.datetime.now() t = dt.datetime.now()
os.system('mpirun -np 12 ./perfect_model_obs') os.system('mpirun -np 12 ./perfect_model_obs')
print('1st perfect_model_obs', (dt.datetime.now()-t).total_seconds()) print('1st perfect_model_obs', (dt.datetime.now()-t).total_seconds())
if channel_id == 6: # cloud dependent observation error
if obscfg['sat']:
if obscfg['channel'] == 6:
# run ./filter to have prior observation estimates from model state # run ./filter to have prior observation estimates from model state
set_input_nml(sat_channel=channel_id, just_prior_values=True) set_input_nml(sat_channel=obscfg['channel'], just_prior_values=True)
t = dt.datetime.now() t = dt.datetime.now()
os.system('mv obs_seq.out obs_seq_all.out; mpirun -np 20 ./filter') os.system('mv obs_seq.out obs_seq_all.out; mpirun -np 20 ./filter')
print('1st filter', (dt.datetime.now()-t).total_seconds()) print('1st filter', (dt.datetime.now()-t).total_seconds())
...@@ -153,7 +151,6 @@ if __name__ == "__main__": ...@@ -153,7 +151,6 @@ if __name__ == "__main__":
# write obs_seq.out # write obs_seq.out
fpath_obsseqout = cluster.dartrundir+'/obs_seq.in' fpath_obsseqout = cluster.dartrundir+'/obs_seq.in'
edit_obserr_in_obsseq(fpath_obsseqout, OEs) edit_obserr_in_obsseq(fpath_obsseqout, OEs)
print('after editing oe', dt.datetime.now())
# generate actual observations (with correct error) # generate actual observations (with correct error)
os.chdir(cluster.dartrundir) os.chdir(cluster.dartrundir)
...@@ -162,10 +159,13 @@ if __name__ == "__main__": ...@@ -162,10 +159,13 @@ if __name__ == "__main__":
print('real obs gen', (dt.datetime.now()-t).total_seconds()) print('real obs gen', (dt.datetime.now()-t).total_seconds())
# correct input.nml for actual assimilation later on # correct input.nml for actual assimilation later on
set_input_nml(sat_channel=channel_id, just_prior_values=False) set_input_nml(sat_channel=obscfg['channel'], just_prior_values=False)
# FIXME: missing is the concatenation of # rename according to i_obs
os.rename(cluster.dartrundir+'/obs_seq.out', cluster.dartrundir+'/obs_seq_'+str(i_obs)+'.out')
# concatenate the created obs_seq_*.out files
os.chdir(cluster.dartrundir) os.chdir(cluster.dartrundir)
os.system('cat obs_seq.out >> obs_seq_all.out') os.system('cat obs_seq_*.out >> obs_seq_all.out')
print(dt.datetime.now()) print(dt.datetime.now())
\ No newline at end of file
# FIXME: what if different channels in one obs_seq.out -> need different input.nml for different channels
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment