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

prepost.dlcdefs: more clear htc master file auto selection

parent 46993cbe
No related branches found
No related tags found
No related merge requests found
......@@ -71,10 +71,11 @@ load calculations, and create load envelopes.
Additional documentation can be found here:
- [Auto-generation of Design Load Cases](docs/howto-make-dlcs.md)
- [How to use the Statistics DataFrame](docs/using-statistics-df.md)
- [Generate DLB spreadsheets](docs/generate-spreadsheet.md)
- [Getting started with DLBs](docs/getting-started-with-dlbs.md)
- [Generate DLB spreadsheets](docs/generate-spreadsheet.md)
- [Auto-generation of Design Load Cases](docs/howto-make-dlcs.md)
- [House rules for storing results on ```mimer/hawc2sim```](docs/houserules-mimerhawc2sim.md)
- [How to use the Statistics DataFrame](docs/using-statistics-df.md)
### [fast](wetb/fast)
Tools for working with NREL's FAST code (An aeroelastic computer-aided engineering (CAE) tool for horizontal axis wind turbines)
......
......@@ -13,10 +13,9 @@ from future.utils import viewitems
from future import standard_library
standard_library.install_aliases()
import os
import unittest
from glob import glob
import pandas as pd
......@@ -62,16 +61,30 @@ def configure_dirs(verbose=False):
def find_master_file(proot, htc_dir='htc', master_dir='_master',
master_contains='_master_'):
pattern='*_master_*'):
"""
Find the master file name. It is assumed that the master file is in the
folder _master, under htc, and contains _master_ in the file name.
folder _master, under htc, and contains _master_ in the file name. If
multiple files contain pattern, the last file of the sorted list is
returned.
Parameters
----------
proot
htc_dir : str, default: htc
master_dir : str, default: _master
pattern : str, default: *_master_*
"""
for root, dirs, files in os.walk(os.path.join(proot, htc_dir, master_dir)):
for fname in files:
if fname.find(master_contains) > -1:
return fname
fpath_search = os.path.join(proot, htc_dir, master_dir, pattern)
files = glob(fpath_search)
if len(files) > 0:
return sorted(files)[-1]
return None
......
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