diff --git a/docs/howto-make-dlcs.md b/docs/howto-make-dlcs.md index e9623a4b733a88ae2c49704d3fad418cb257f069..9e2db0e02878b38789312f8327470d4f0b32a90f 100644 --- a/docs/howto-make-dlcs.md +++ b/docs/howto-make-dlcs.md @@ -454,7 +454,7 @@ tags: * ```[MannAlfaEpsilon]``` * ```[MannL]``` * ```[MannGamma]``` -* ```[tu_seed]``` +* ```[seed]``` * ```[turb_nr_u]``` : number of grid points in the u direction * ```[turb_nr_v]``` : number of grid points in the v direction * ```[turb_nr_w]``` : number of grid points in the w direction diff --git a/wetb/prepost/Simulations.py b/wetb/prepost/Simulations.py index a7edd8a1b65e47b7be86dca667d572d55f8c8c01..ad22964dcbb270fde671d6143b54772c75741d5e 100755 --- a/wetb/prepost/Simulations.py +++ b/wetb/prepost/Simulations.py @@ -4003,7 +4003,7 @@ class Cases(object): return stats_df, Leq_df, AEP_df def statistics(self, new_sim_id=False, silent=False, ch_sel=None, - tags=['[turb_seed]','[windspeed]'], calc_mech_power=False, + tags=['[seed]','[windspeed]'], calc_mech_power=False, save=True, m=[3, 4, 6, 8, 10, 12], neq=None, no_bins=46, ch_fatigue={}, update=False, add_sensor=None, chs_resultant=[], i0=0, i1=None, saveinterval=1000, @@ -4020,7 +4020,7 @@ class Cases(object): If defined, only add defined channels to the output data frame. The list should contain valid channel names as defined in ch_dict. - tags : list, default=['[turb_seed]','[windspeed]'] + tags : list, default=['[seed]','[windspeed]'] Select which tag values from cases should be included in the dataframes. This will help in selecting and identifying the different cases. @@ -4173,6 +4173,7 @@ class Cases(object): template = "self.sig[:,self.res.ch_dict['{}']['chi']]" for chan in channel_tags: # first remove the [] from the tag + # FIXME: fails when the same channel occurs more than once expr = expr.replace(chan, chan[1:-1]) expr = expr.replace(chan[1:-1], template.format(chan[1:-1])) @@ -4912,7 +4913,7 @@ class Cases(object): return df_AEP - def stats2dataframe(self, ch_sel=None, tags=['[turb_seed]','[windspeed]']): + def stats2dataframe(self, ch_sel=None, tags=['[seed]','[windspeed]']): """ Convert the archaic statistics dictionary of a group of cases to a more convienent pandas dataframe format. @@ -4930,7 +4931,7 @@ class Cases(object): defined, only those channels are considered. ch_sel[short name] = full ch_dict identifier - tags : list, default=['[turb_seed]','[windspeed]'] + tags : list, default=['[seed]','[windspeed]'] Select which tag values from cases should be included in the dataframes. This will help in selecting and identifying the different cases. @@ -5377,7 +5378,7 @@ class MannTurb64(prepost.PBSScript): * [MannAlfaEpsilon] * [MannL] * [MannGamma] - * [tu_seed] + * [seed] * [turb_nr_u] * [turb_nr_v] * [turb_nr_w] @@ -5454,7 +5455,7 @@ class MannTurb64(prepost.PBSScript): rpl = (float(case['[MannAlfaEpsilon]']), float(case['[MannL]']), float(case['[MannGamma]']), - int(case['[tu_seed]']), + int(case['[seed]']), int(case['[turb_nr_u]']), int(case['[turb_nr_v]']), int(case['[turb_nr_w]']), diff --git a/wetb/prepost/dlcdefs.py b/wetb/prepost/dlcdefs.py index a8d8b123e84f941ec6ec5ea3b8d145e960bef563..e1a8b99b332ee0a419271d9ffa439f38fefff9f7 100644 --- a/wetb/prepost/dlcdefs.py +++ b/wetb/prepost/dlcdefs.py @@ -27,7 +27,7 @@ def casedict2xlsx(): """ -def configure_dirs(verbose=False): +def configure_dirs(verbose=False, pattern_master='*_master_*'): """ Automatically configure required directories to launch simulations """ @@ -40,7 +40,7 @@ def configure_dirs(verbose=False): PROJECT = P_RUN.split(os.sep)[-2] sim_id = P_RUN.split(os.sep)[-1] - master = find_master_file(P_SOURCE) + master = find_master_file(P_SOURCE, pattern=pattern_master) if master is None: raise ValueError('Could not find master file in htc/_master') MASTERFILE = master @@ -169,7 +169,7 @@ def tags_dlcs(master): master.tags['[Windspeed]'] = 8 master.tags['[wdir]'] = 0 # used for the user defined wind master.tags['[wdir_rot]'] = 0 # used for the windfield rotations - master.tags['[tu_seed]'] = 0 + master.tags['[seed]'] = None master.tags['[tu_model]'] = 0 master.tags['[TI]'] = 0 master.tags['[Turb base name]'] = 'none' @@ -363,10 +363,21 @@ def excel_stabcon(proot, fext='xlsx', pignore=None, pinclude=None, sheet=0, elif tags_dict[str(key)].lower() == 'nan': tags_dict[str(key)] = True + # FIXME: this horrible mess requires a nice and clearly defined + # tag spec/naming convention, and with special tag prefix if '[Windspeed]' not in tags_dict and '[wsp]' in tags_dict: tags_dict['[Windspeed]'] = tags_dict['[wsp]'] + # avoid that any possible default tags from wetb will be used + # instead of the ones from the spreadsheet if '[seed]' in tags_dict: tags_dict['[tu_seed]'] = tags_dict['[seed]'] + # in case people are using other turbulence tag names in the sheet + elif '[tu_seed]' in tags_dict: + tags_dict['[seed]'] = tags_dict['[tu_seed]'] + elif '[turb_seed]' in tags_dict: + tags_dict['[seed]'] = tags_dict['[turb_seed]'] + else: + raise KeyError('[seed] should be used as tag for turb. seed') tags_dict['[Case folder]'] = tags_dict['[Case folder]'].lower() tags_dict['[Case id.]'] = tags_dict['[Case id.]'].lower() diff --git a/wetb/prepost/dlctemplate.py b/wetb/prepost/dlctemplate.py index c7827ed6108959b59ce4f394852ae7c725740449..e056518739425b28646324a6a502f2b7f12f8d87 100644 --- a/wetb/prepost/dlctemplate.py +++ b/wetb/prepost/dlctemplate.py @@ -127,7 +127,7 @@ def master_tags(sim_id, runmethod='local', silent=False, verbose=False): master.tags['[MannAlfaEpsilon]'] = 1.0 master.tags['[MannL]'] = 29.4 master.tags['[MannGamma]'] = 3.0 - master.tags['[tu_seed]'] = 0 + master.tags['[seed]'] = None master.tags['[turb_nr_u]'] = 8192 master.tags['[turb_nr_v]'] = 32 master.tags['[turb_nr_w]'] = 32 diff --git a/wetb/prepost/tests/data/demo_dlc/ref/htc/DLCs/dlc01_demos.xlsx b/wetb/prepost/tests/data/demo_dlc/ref/htc/DLCs/dlc01_demos.xlsx index 2725ebf94c486118c288c7b1bf73bfba9fb79afd..6b4bb2d9fe4f7b5b2e347ecb8da55e2cd3695669 100755 Binary files a/wetb/prepost/tests/data/demo_dlc/ref/htc/DLCs/dlc01_demos.xlsx and b/wetb/prepost/tests/data/demo_dlc/ref/htc/DLCs/dlc01_demos.xlsx differ diff --git a/wetb/prepost/tests/data/demo_dlc/ref/prepost/remote.pkl b/wetb/prepost/tests/data/demo_dlc/ref/prepost/remote.pkl index 424870abe4d235d40b0bc86884127247ace71cde..76f3458974d302669780c4e764e56dec5a7d545b 100644 Binary files a/wetb/prepost/tests/data/demo_dlc/ref/prepost/remote.pkl and b/wetb/prepost/tests/data/demo_dlc/ref/prepost/remote.pkl differ diff --git a/wetb/prepost/tests/data/demo_dlc/ref/prepost/remote_tags.txt b/wetb/prepost/tests/data/demo_dlc/ref/prepost/remote_tags.txt index eebe622e1cd2307810c65f8ed345bec9f81ebe5d..c9bef2a6ba10c1291db7d183aa091af4f542d6ec 100644 --- a/wetb/prepost/tests/data/demo_dlc/ref/prepost/remote_tags.txt +++ b/wetb/prepost/tests/data/demo_dlc/ref/prepost/remote_tags.txt @@ -50,6 +50,7 @@ [pbs_in_dir] : pbs_in/dlc01_demos/ [pbs_out_dir] : pbs_out/dlc01_demos/ [res_dir] : res/dlc01_demos/ + [seed] : 0 [shear_exp] : 0 [staircase] : False [t flap on] : -1 @@ -106,6 +107,7 @@ [pbs_in_dir] : pbs_in/dlc01_demos/ [pbs_out_dir] : pbs_out/dlc01_demos/ [res_dir] : res/dlc01_demos/ + [seed] : 0 [shear_exp] : 0 [staircase] : False [t flap on] : -1 @@ -162,6 +164,7 @@ [pbs_in_dir] : pbs_in/dlc01_demos/ [pbs_out_dir] : pbs_out/dlc01_demos/ [res_dir] : res/dlc01_demos/ + [seed] : 100 [shear_exp] : 0 [staircase] : False [t flap on] : -1 @@ -218,6 +221,7 @@ [pbs_in_dir] : pbs_in/dlc01_demos/ [pbs_out_dir] : pbs_out/dlc01_demos/ [res_dir] : res/dlc01_demos/ + [seed] : 100 [shear_exp] : 0 [staircase] : False [t flap on] : -1 diff --git a/wetb/prepost/tests/data/demo_dlc/source/demo_dlc_remote.zip b/wetb/prepost/tests/data/demo_dlc/source/demo_dlc_remote.zip index 3c02a1d7a11acaeff10fdae72416c4856fcbc4bc..653dd7fa920d3d0154225072507087b8fbf3cfa0 100644 Binary files a/wetb/prepost/tests/data/demo_dlc/source/demo_dlc_remote.zip and b/wetb/prepost/tests/data/demo_dlc/source/demo_dlc_remote.zip differ