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

prepost.dlctemplate: align case_id merging tag, update help menu

parent f2568ac1
No related branches found
No related tags found
No related merge requests found
Pipeline #
...@@ -524,11 +524,20 @@ def postpro_node_merge(tqdm=False, zipchunks=False): ...@@ -524,11 +524,20 @@ def postpro_node_merge(tqdm=False, zipchunks=False):
required = ['[DLC]', '[run_dir]', '[wdir]', '[Windspeed]', '[res_dir]', required = ['[DLC]', '[run_dir]', '[wdir]', '[Windspeed]', '[res_dir]',
'[case_id]'] '[case_id]']
df = pd.read_hdf(fdf, 'table') df = pd.read_hdf(fdf, 'table')
# df now has case_id as the path to the statistics file: res/dlc12_xxx/yyy
# while df_tags will have just yyy as case_id
tmp = df['[case_id]'].str.split('/', expand=True)
df['[case_id]'] = tmp[tmp.columns[-1]]
cc = sim.Cases(POST_DIR, sim_id) cc = sim.Cases(POST_DIR, sim_id)
df_tags = cc.cases2df()[required] df_tags = cc.cases2df()[required]
df_stats = pd.merge(df, df_tags, on=['[case_id]']) df_stats = pd.merge(df, df_tags, on=['[case_id]'])
df_stats.to_hdf(fdf, 'table') # if the merge didn't work due to other misaligned case_id tags, do not
df_stats.to_csv(fdf.replace('.h5', '.csv')) # overwrite our otherwise ok tables!
if len(df_stats) == len(df):
df_stats.to_hdf(fdf, 'table', mode='w')
df_stats.to_csv(fdf.replace('.h5', '.csv'))
if __name__ == '__main__': if __name__ == '__main__':
...@@ -593,7 +602,9 @@ if __name__ == '__main__': ...@@ -593,7 +602,9 @@ if __name__ == '__main__':
help='Merge all individual statistics and log file ' help='Merge all individual statistics and log file '
'analysis .csv files into one table/pd.DataFrame. ' 'analysis .csv files into one table/pd.DataFrame. '
'Requires that htc files have been created with ' 'Requires that htc files have been created with '
'--prep --postpro_node.') '--prep --postpro_node. Combine with --zipchunks when '
'--prep --zipchunks was used in for generating and '
'running all simulations.')
parser.add_argument('--gendlcs', default=False, action='store_true', parser.add_argument('--gendlcs', default=False, action='store_true',
help='Generate DLC exchange files based on master DLC ' help='Generate DLC exchange files based on master DLC '
'spreadsheet.') 'spreadsheet.')
......
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