diff --git a/openfast_toolbox/io/fast_output_file.py b/openfast_toolbox/io/fast_output_file.py index 3ac89a6..2227530 100644 --- a/openfast_toolbox/io/fast_output_file.py +++ b/openfast_toolbox/io/fast_output_file.py @@ -614,7 +614,8 @@ def freadRowOrderTableBuffered(fid, n, type_in, nCols, nOff=0, type_out='float64 data[:,0] = time else: # NOTE: memory expensive due to time conversion, and concatenation - data = (data - ColOff) / ColScl + if FileID != FileFmtID_NoCompressWithoutTime: # uncompressed data are not scaled + data = (data - ColOff) / ColScl data = np.concatenate([time.reshape(NT, 1), data], 1) info = {'name': os.path.splitext(os.path.basename(filename))[0], diff --git a/openfast_toolbox/io/tests/example_files/FASTOutBin_ID3.outb b/openfast_toolbox/io/tests/example_files/FASTOutBin_ID3.outb new file mode 100644 index 0000000..0f2a199 Binary files /dev/null and b/openfast_toolbox/io/tests/example_files/FASTOutBin_ID3.outb differ diff --git a/openfast_toolbox/io/tests/test_fast_output.py b/openfast_toolbox/io/tests/test_fast_output.py index 7b527e4..6513850 100644 --- a/openfast_toolbox/io/tests/test_fast_output.py +++ b/openfast_toolbox/io/tests/test_fast_output.py @@ -39,6 +39,17 @@ def test_FASTOutBin(self): except: pass + def test_FASTOutBin_uncompressed(self): + # Uncompressed binary (FileID 3), written by OpenFAST with OutFileFmt=4 + filename = os.path.join(MyDir,'FASTOutBin_ID3.outb') + M = FASTOutputFile(filename).toDataFrame() + np.testing.assert_allclose(M['Time_[s]'].values, [0, 0.025, 0.05, 0.075, 0.1]) + # Values from the text output of the same run + np.testing.assert_allclose(M['TwrBsFxt_[kN]'].values, [10.448863, 0.17119217, 8.0563698, -1.2610151, 26.274128], rtol=1e-7) + # Buffered reading gives the same data + M2 = FASTOutputFile(filename, use_buffer=True).toDataFrame() + np.testing.assert_array_equal(M.values, M2.values) + if __name__ == '__main__': # Test().test_000_debug() unittest.main()