diff --git a/wetb/dlc/high_level.py b/wetb/dlc/high_level.py index 418de910337dafd4fb557fdb99e75e126d8b1f27..0edfa43b109cd4eba748e6ba881f2a663129a525 100644 --- a/wetb/dlc/high_level.py +++ b/wetb/dlc/high_level.py @@ -231,10 +231,11 @@ class DLCHighLevel(object): fatigue_dlcs = self.dlc_df[['F' in str(l).upper() for l in self.dlc_df['load']]]['dlc'] if len(fatigue_dlcs) == 0: return {} + ext = getattr(self, 'res_ext', ".sel") if isinstance(files, list): pass elif not hasattr(self, "res_folder") or self.res_folder == "": - files = glob.glob(os.path.join(self.res_path, "*.sel")) + glob.glob(os.path.join(self.res_path, "*/*.sel")) + files = glob.glob(os.path.join(self.res_path, "*"+ext)) + glob.glob(os.path.join(self.res_path, "*/*"+ext)) else: files = [] @@ -244,7 +245,7 @@ class DLCHighLevel(object): folder = self.res_folder % dlc_id else: folder = self.res_folder - files.extend(glob.glob(os.path.join(self.res_path , folder, "*.sel"))) + files.extend(glob.glob(os.path.join(self.res_path , folder, "*"+ext))) keys = list(zip(*self.dist_value_keys))[1] fmt = self.format_tag_value tags = [[fmt(tag.replace(key, "")) for tag, key in zip(os.path.basename(f).split("_"), keys)] for f in files] diff --git a/wetb/dlc/tests/test_files/DLC_test_flex.xlsx b/wetb/dlc/tests/test_files/DLC_test_flex.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..cebcdd2ae3eeff59369e4a1950700f0679e3883a Binary files /dev/null and b/wetb/dlc/tests/test_files/DLC_test_flex.xlsx differ diff --git a/wetb/dlc/tests/test_files/res/dlc12_iec61400-1ed3/dlc12_wsp04_wdir350_s3001.int b/wetb/dlc/tests/test_files/res/dlc12_iec61400-1ed3/dlc12_wsp04_wdir350_s3001.int new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/wetb/dlc/tests/test_high_level.py b/wetb/dlc/tests/test_high_level.py index 473e81bd6d36eb1adc54304b2d75ede8b0413fdc..a8dbb08322765951ef46ebe87e438f3e56b8c42d 100644 --- a/wetb/dlc/tests/test_high_level.py +++ b/wetb/dlc/tests/test_high_level.py @@ -56,6 +56,11 @@ class TestDLCHighLevel(unittest.TestCase): self.assertEqual(os.path.abspath(f), os.path.abspath(testfilepath + 'res/dlc31_iec61400-1ed3/dlc31_wsp25_wdir000_s0000.sel')) self.assertAlmostEqual(h, 0.0087201928 * 1 * (50 / 1100) * 20 * 365 * 24) + def test_file_dict_flex(self): + + dlc_hl = DLCHighLevel(testfilepath + 'DLC_test_flex.xlsx') + self.assertEqual(dlc_hl.files_dict()[12][4][350]['files'], ['C:/mmpe/programming/python/WindEnergyToolbox/wetb/dlc/tests\\test_files\\res\\dlc12_iec61400-1ed3\\dlc12_wsp04_wdir350_s3001.int']) + def test_dlc_lst(self): self.assertEqual(self.dlc_hl.dlc_lst(), ['12', '13', '14', '31'])