Skip to content
Snippets Groups Projects
Commit 150e0f1a authored by mads's avatar mads
Browse files

temp change for debug

parent 85463b3c
No related branches found
No related tags found
No related merge requests found
...@@ -61,10 +61,16 @@ def load_binary_output(filename): ...@@ -61,10 +61,16 @@ def load_binary_output(filename):
% Edited for FAST v7.02.00b-bjj 22-Oct-2012 % Edited for FAST v7.02.00b-bjj 22-Oct-2012
""" """
def fread(fid, n, type): def fread(fid, n, type):
fmt, nbytes = {'uint8': ('B', 1), 'int16':('h', 2), 'int32':('i', 4), 'float32':('f', 4), 'float64':('d', 8)}[type] fmt, nbytes = {'uint8': ('B', 1), 'int16':('h', 2), 'int32':('q', 4), 'float32':('f', 4), 'float64':('d', 8)}[type]
return struct.unpack(fmt * n, fid.read(nbytes * n)) return struct.unpack(fmt * n, fid.read(nbytes * n))
def fread2(fid, n, type):
fmt, nbytes = {'uint8': ('B', 1), 'int16':('h', 2), 'int32':('q', 4), 'float32':('f', 4), 'float64':('d', 8)}[type]
x = fid.read(nbytes * n)
d = struct.unpack(fmt * n, x)
print (n, type, fmt, nbytes, x, d)
return d
FileFmtID_WithTime = 1 #% File identifiers used in FAST FileFmtID_WithTime = 1 #% File identifiers used in FAST
FileFmtID_WithoutTime = 2 FileFmtID_WithoutTime = 2
LenName = 10 #; % number of characters per channel name LenName = 10 #; % number of characters per channel name
...@@ -73,7 +79,7 @@ def load_binary_output(filename): ...@@ -73,7 +79,7 @@ def load_binary_output(filename):
with open(filename, 'rb') as fid: with open(filename, 'rb') as fid:
FileID = fread(fid, 1, 'int16') #; % FAST output file format, INT(2) FileID = fread(fid, 1, 'int16') #; % FAST output file format, INT(2)
NumOutChans = fread(fid, 1, 'int32')[0] #; % The number of output channels, INT(4) NumOutChans = fread2(fid, 1, 'int32')[0] #; % The number of output channels, INT(4)
NT = fread(fid, 1, 'int32')[0] #; % The number of time steps, INT(4) NT = fread(fid, 1, 'int32')[0] #; % The number of time steps, INT(4)
if FileID == FileFmtID_WithTime: if FileID == FileFmtID_WithTime:
......
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