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. ...@@ -71,10 +71,11 @@ load calculations, and create load envelopes.
Additional documentation can be found here: Additional documentation can be found here:
- [Auto-generation of Design Load Cases](docs/howto-make-dlcs.md) - [Getting started with DLBs](docs/getting-started-with-dlbs.md)
- [How to use the Statistics DataFrame](docs/using-statistics-df.md) - [Generate DLB spreadsheets](docs/generate-spreadsheet.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) ### [fast](wetb/fast)
Tools for working with NREL's FAST code (An aeroelastic computer-aided engineering (CAE) tool for horizontal axis wind turbines) 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 ...@@ -13,10 +13,9 @@ from future.utils import viewitems
from future import standard_library from future import standard_library
standard_library.install_aliases() standard_library.install_aliases()
import os import os
import unittest import unittest
from glob import glob
import pandas as pd import pandas as pd
...@@ -62,16 +61,30 @@ def configure_dirs(verbose=False): ...@@ -62,16 +61,30 @@ def configure_dirs(verbose=False):
def find_master_file(proot, htc_dir='htc', master_dir='_master', 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 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)): fpath_search = os.path.join(proot, htc_dir, master_dir, pattern)
for fname in files: files = glob(fpath_search)
if fname.find(master_contains) > -1: if len(files) > 0:
return fname return sorted(files)[-1]
return None 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