Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Updated utility to read in linked list data directly without needing the stack file
  • Loading branch information
daminton committed Jul 18, 2022
1 parent c33b2e9 commit 6cde634
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions python/ctem/ctem/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,17 +281,12 @@ def read_unformatted_binary(filename, gridsize, kind='DP'):
return data


def read_linked_list_binary(filename, stackname, gridsize):
stack = read_unformatted_binary(stackname,gridsize,kind='I4B')
def read_linked_list_binary(filename, gridsize):
data = np.empty((gridsize,gridsize),dtype="object")
with FortranFile(filename, 'r') as f:
for i in np.arange(gridsize):
for j in np.arange(gridsize):
datastack = []
for s in np.arange(stack[j, i]):
d = f.read_reals(np.float64)
datastack.append(d)
data[j, i] = np.asarray(datastack).T
data[j, i] = f.read_reals(np.float64)
return data


Expand Down

0 comments on commit 6cde634

Please sign in to comment.