def test_load_binary(): data, info = load_output(testfilepath + 'test_binary.outb') npt.assert_equal(info['name'], 'test_binary') npt.assert_equal(info['description'], 'Modified by mwDeriveSensors on 27-Jul-2015 16:32:06') npt.assert_equal(info['attribute_names'][4], 'RotPwr') npt.assert_equal(info['attribute_units'][7], 'deg/s^2') npt.assert_almost_equal(data[10, 4], 138.822277739535)
def test_load_bindary_fid(fid, tol, buffer): data2, info2 = load_output(testfilepath + '5MW_Land_BD_DLL_WTurb_fid04.outb') data, info = load_binary_output(testfilepath + '5MW_Land_BD_DLL_WTurb_fid%02d.outb' % fid, use_buffer=buffer) for k, v in info2.items(): if k not in {'name', 'description'}: npt.assert_array_equal(info[k], v) r = data.max(0) - data.min(0) + 1e-20 npt.assert_array_less(np.abs(data - data2).max(0), r * tol)
def run_and_get_results(spawner, path_): task = spawner.spawn(str(path_), {}) luigi.build([task], local_scheduler=True, log_level='WARNING') output_path = task.output().path if not path.isfile(output_path): with open(path.splitext(output_path)[0] + '.log') as fp: log = fp.read() raise ChildProcessError('FAST run did not produce output. Log:' + linesep + log) data, info = fast_io.load_output(output_path) return pd.DataFrame(data, columns=info['attribute_names'])
def test_load_output3(self): # This file has an extra comment at the end data, info = load_output(testfilepath + 'FASTOut_Hydro.out') self.assertAlmostEqual(data[3, 1], -1.0E+01)
def test_load_output2(self): data, info = load_output(testfilepath + 'DTU10MW.out') self.assertEqual(info['name'], "DTU10MW") self.assertEqual(info['attribute_names'][1], "RotPwr") self.assertEqual(info['attribute_units'][1], "kW")
def test_load_output(): data, info = load_output(testfilepath + 'DTU10MW.out') npt.assert_equal(data[4, 3], 4.295E-04) npt.assert_equal(info['name'], "DTU10MW") npt.assert_equal(info['attribute_names'][1], "RotPwr") npt.assert_equal(info['attribute_units'][1], "kW")