Skip to content
Snippets Groups Projects

Some fast out files have a different number of header lines

Closed Emmanuel Branlard requested to merge wtlib/WindEnergyToolbox:f/FastIO into master
1 unresolved thread

Some of the fast out file (in particular the one outputted by HydroDyn) have a different nunber of headerlines and may have a line of comment at the end. This fix should help reading any kind of out ascii files from Fast and its different modules.

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
59 in_header= (l+' dummy').lower().split()[0] != 'time'
60 if in_header:
61 header.append(l)
62 else:
63 info['description'] = header
64 info['attribute_names'] = l.split()
65 info['attribute_units'] = [unit[1:-1] for unit in f.readline().split()]
66
67 # Data, up to end of file or empty line (potential comment line at the end)
68 split_lines=[]
69 while True:
70 l = f.readline().strip()
71 if not l or len(l)==0:
72 break
73 split_lines.append(l.split())
74 data = np.array(split_lines).astype(np.float)
  • Thank you @ebranlard for your merge requests.

    Do you have a short example file, that we can use for testing

    I am not able to merge it because the pipeline fails, and when I try to run it, it runs for your namespace. A solution could be to push it to a feature branch in toolbox/WindEnergyToolbox

    Mads

  • Hi Mads,

    I'm enclosing a test file.

    I cannot create branches to the toolbox, can you grant my user access to it?

    Thanks

    FASTOut_Hydro.out

  • Emmanuel Branlard mentioned in merge request !69 (merged)

    mentioned in merge request !69 (merged)

  • Please register or sign in to reply
    Loading