示例#1
0
文件: test_sum.py 项目: trhallam/ecl
        with self.assertRaises(ValueError):
            frame = case.pandas_frame(column_keys=[])

        with self.assertRaises(ValueError):
            frame = case.pandas_frame(column_keys=["NO_KEY"])

        frame = case.pandas_frame()
        rows, columns = frame.shape
        self.assertEqual(len(case.keys()), columns)
        self.assertEqual(len(case), rows)

    def test_csv_load(self):
        case = create_case2()
        frame = case.pandas_frame()
        ecl_sum = EclSum.from_pandas("PANDAS", frame, dims=[20, 10, 5])

        for key in frame.columns:
            self.assertTrue(key in ecl_sum)

        df = ecl_sum.pandas_frame()
        assert_frame_equal(frame, df)

        ecl_sum_less = EclSum.from_pandas(
            "PANDAS",
            frame,
            dims=[20, 10, 5],
            headers=["BPR:10", "RPR:3,1,1", "COPR:OPX:1,2,3"],
        )
        del frame["WOPT:OPX"]
        del frame["FOPR"]
示例#2
0
        with self.assertRaises(ValueError):
            frame = case.pandas_frame(column_keys=[])

        with self.assertRaises(ValueError):
            frame = case.pandas_frame(column_keys=["NO_KEY"])

        frame = case.pandas_frame( )
        rows, columns = frame.shape
        self.assertEqual(len(case.keys()), columns)
        self.assertEqual(len(case), rows)


    def test_csv_load(self):
        case = create_case2()
        frame = case.pandas_frame()
        ecl_sum = EclSum.from_pandas("PANDAS", frame, dims=[20,10,5])

        for key in frame.columns:
            self.assertTrue(key in ecl_sum)

        df = ecl_sum.pandas_frame()
        assert_frame_equal(frame, df)

        ecl_sum_less = EclSum.from_pandas("PANDAS", frame, dims=[20,10,5], headers=['BPR:10', 'RPR:3,1,1', 'COPR:OPX:1,2,3'])
        del frame['WOPT:OPX']
        del frame['FOPR']
        df_less = ecl_sum_less.pandas_frame()
        assert_frame_equal(frame, df_less)


    def test_total_and_rate(self):