Skip to content

Updated parse_data to deal with more than 200 directional bins aand zeros #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions oceanwaves/swan.py
Original file line number Diff line number Diff line change
Expand Up @@ -501,8 +501,17 @@ def parse_data(self):
else:
f = 1.

n = len(self.frequencies)
q = np.asarray(self.lines.read_blockbody(n)) * f
if len(self.directions)<= 200:
n = len(self.frequencies)
q = np.asarray(self.lines.read_blockbody(n), dtype=np.float64) * f
else:
n = int(np.ceil(len(self.directions)/200))*len(self.frequencies)
temp = self.lines.read_blockbody(n)
temp_q=[]
for ii in range(len(self.frequencies)):
temp_q.append(temp[2*ii]+temp[2*ii+1])
q = np.asarray(temp_q, dtype=np.float64) * f

if self.stationary:
self.quantities.append(q)
else:
Expand Down