From ab386f4003c77c6c05dc7cec3336ee1803710a8c Mon Sep 17 00:00:00 2001 From: Guillaume Jacquenot Date: Sat, 21 Dec 2024 17:04:12 +0100 Subject: [PATCH] :sparkle: Added a dedicated entrypoint --- openfast_python/openfast_io/turbsim_file.py | 25 ++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/openfast_python/openfast_io/turbsim_file.py b/openfast_python/openfast_io/turbsim_file.py index e852ea838..9cd6ed1e8 100644 --- a/openfast_python/openfast_io/turbsim_file.py +++ b/openfast_python/openfast_io/turbsim_file.py @@ -5,6 +5,7 @@ """ import pandas as pd import numpy as np +import argparse import os import struct import time @@ -311,5 +312,27 @@ def compute_rot_avg(self, R): self['rot_avg'][i,:] = u_rot +def main(): + # Create argument parser + parser = argparse.ArgumentParser( + description="Read an OpenFAST .bts wind field files") + parser.add_argument( + "input_file", + type=str, + help="Path to the input .bts file." + ) + + # Parse arguments + args = parser.parse_args() + + # Process input and output files + input_file = args.input_file + # ts = TurbSimFile('../_tests/TurbSim.bts') + ts = TurbSimFile(input_file) + df = ts.toDataFrame() + print(df['VertProfile'].info()) + print(df['MidLine'].info()) + + if __name__=='__main__': - ts = TurbSimFile('../_tests/TurbSim.bts') + main()