Skip to content
Snippets Groups Projects
Commit f29a1dfb authored by Mads M. Pedersen's avatar Mads M. Pedersen
Browse files

Merge branch 'dlc_highlevel_support_for_flex' into 'master'

Merge of dlc_highlevel_support_for_flex to master

See merge request !28
parents 89a2d79c f98255ed
No related branches found
No related tags found
1 merge request!28Merge of dlc_highlevel_support_for_flex to master
Pipeline #
......@@ -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]
......
File added
......@@ -56,6 +56,12 @@ 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')
file_lst = dlc_hl.files_dict()[12][4][350]["files"]
self.assertEqual(len(file_lst),1)
self.assertTrue(file_lst[0].endswith(".int"))
def test_dlc_lst(self):
self.assertEqual(self.dlc_hl.dlc_lst(), ['12', '13', '14', '31'])
......
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