Skip to content
Snippets Groups Projects
Commit af4aeb2a authored by David Verelst's avatar David Verelst
Browse files

prepost: some fixes for dlcplot related issues

parent 0c318b1e
No related branches found
No related tags found
No related merge requests found
Pipeline #
......@@ -57,6 +57,9 @@ def merge_sim_ids(sim_ids, post_dirs, post_dir_save=False):
"""
# map the run_dir to the same order as the post_dirs, labels
run_dirs = []
# avoid saving merged cases if there is only one!
if type(sim_ids).__name__ == 'list' and len(sim_ids) == 1:
sim_ids = sim_ids[0]
# if sim_id is a list, combine the two dataframes into one
df_stats = pd.DataFrame()
......@@ -99,15 +102,16 @@ def merge_sim_ids(sim_ids, post_dirs, post_dir_save=False):
pass
else:
fpath = os.path.join(post_dir, '-'.join(sim_ids) + '.h5')
fmerged = fpath.replace('.h5', '_statistics.h5')
if ii == 0:
# and save somewhere so we can add the second data frame on
# disc
df_stats.to_hdf(fpath, 'table', mode='w', format='table',
df_stats.to_hdf(fmerged, 'table', mode='w', format='table',
complevel=9, complib='blosc')
print('%s merged stats written to: %s' % (sim_id, fpath))
else:
# instead of doing a concat in memory, add to the hdf store
df_stats.to_hdf(fpath, 'table', mode='r+', format='table',
df_stats.to_hdf(fmerged, 'table', mode='r+', format='table',
complevel=9, complib='blosc', append=True)
print('%s merging stats into: %s' % (sim_id, fpath))
# df_stats = pd.concat([df_stats, df_stats2], ignore_index=True)
......@@ -453,7 +457,7 @@ def plot_dlc_stats(df_stats, plot_chans, fig_dir_base, labels=None,
mfcs3 = ['r', 'w']
stds = ['r', 'b']
required = ['[DLC]', '[run_dir]', '[wdir]', '[Windspeed]']
required = ['[DLC]', '[run_dir]', '[wdir]', '[Windspeed]', '[res_dir]']
cols = df_stats.columns
for col in required:
if col not in cols:
......
......@@ -393,7 +393,8 @@ def post_launch(sim_id, statistics=True, rem_failed=True, check_logs=True,
# add_sigs = {name:expr}
# in addition, sim_id and case_id are always added by default
tags = ['[Case folder]']
tags = ['[Case folder]', '[run_dir]', '[res_dir]', '[DLC]',
'[wsp]', '[Windspeed]', '[wdir]']
add = None
# general statistics for all channels channel
# set neq=None here to calculate 1Hz equivalent loads
......@@ -538,7 +539,6 @@ if __name__ == '__main__':
P_RUN, P_SOURCE, PROJECT, sim_id, P_MASTERFILE, MASTERFILE, POST_DIR \
= dlcdefs.configure_dirs(verbose=True)
# create HTC files and PBS launch scripts (*.p)
if opt.prep:
print('Start creating all the htc files and pbs_in files...')
......@@ -569,12 +569,11 @@ if __name__ == '__main__':
for nr in [1, 2, 3]:
rpl = (nr, nr, node_nr, comp)
chans.append('blade%i-blade%i-node-%03i-momentvec-%s' % rpl)
plot_chans['$M_%s B123_{%i}$' % (comp, node_lab)] = chans
plot_chans['$M_%s B123_{%s}$' % (comp, node_lab)] = chans
chans = []
# combine blade 1,2,3 pitch angle stats into a single plot
for nr in [1, 2, 3]:
rpl = (nr, nr, node_nr, comp)
chans.append('bearing-pitch%i-angle-deg' % nr)
plot_chans['$B123_{pitch}$'] = chans
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment