Exemplo n.º 1
0
    def test_invalid(self):
        case = create_case()
        with TestAreaContext("sum_invalid"):
            case.fwrite( )
            with open("CASE.txt", "w") as f:
                f.write("No - this is not EclKW file ....")

            with self.assertRaises( IOError ):
                case2 = EclSum.load( "CSV.SMSPEC" , "CASE.txt" )

            with self.assertRaises( IOError ):
                case2 = EclSum.load( "CASE.txt" , "CSV.UNSMRY" )

            kw1 = EclKW("TEST1", 30, EclDataType.ECL_INT)
            kw2 = EclKW("TEST2", 30, EclDataType.ECL_INT)

            with openFortIO( "CASE.KW" , FortIO.WRITE_MODE) as f:
                kw1.fwrite( f )
                kw2.fwrite( f )

            with self.assertRaises( IOError ):
                case2 = EclSum.load( "CSV.SMSPEC" , "CASE.KW")

            with self.assertRaises( IOError ):
                case2 = EclSum.load( "CASE.KW" , "CSV.UNSMRY" )
Exemplo n.º 2
0
    def test_different_names(self):
        case = create_case()
        with TestAreaContext("sum_different"):
            case.fwrite( )
            shutil.move("CSV.SMSPEC" , "CSVX.SMSPEC")
            with self.assertRaises(IOError):
                case2 = EclSum.load( "Does/not/exist" , "CSV.UNSMRY")

            with self.assertRaises(IOError):
                case2 = EclSum.load( "CSVX.SMSPEC" , "CSVX.UNSMRY")

            case2 = EclSum.load( "CSVX.SMSPEC" , "CSV.UNSMRY" )
            self.assert_solve( case2 )
            self.assertEqual(case.unit("FOPR"), "SM3/DAY")
Exemplo n.º 3
0
    def test_different_names(self):
        length = 100
        case = createEclSum("CSV", [("FOPT", None, 0), ("FOPR", None, 0),
                                    ("FGPT", None, 0)],
                            sim_length_days=length,
                            num_report_step=10,
                            num_mini_step=10,
                            func_table={
                                "FOPT": fopt,
                                "FOPR": fopr,
                                "FGPT": fgpt
                            })

        with TestAreaContext("sum_different"):
            case.fwrite()
            shutil.move("CSV.SMSPEC", "CSVX.SMSPEC")
            with self.assertRaises(IOError):
                case2 = EclSum.load("Does/not/exist", "CSV.UNSMRY")

            with self.assertRaises(IOError):
                case2 = EclSum.load("CSVX.SMSPEC", "CSVX.UNSMRY")

            case2 = EclSum.load("CSVX.SMSPEC", "CSV.UNSMRY")
            self.assert_solve(case2)
Exemplo n.º 4
0
        sol = case.solveDates("FGPT", 25)
        self.assertEqual(len(sol), 2)
        t0 = case.getDataStartTime()
        t1 = t0 + datetime.timedelta(days=25)
        t2 = t0 + datetime.timedelta(days=75)
        self.assertEqual(sol[0], t1)
        self.assertEqual(sol[1], t2)

    def test_different_names(self):
        case = create_case()
        with TestAreaContext("sum_different"):
            case.fwrite()
            shutil.move("CSV.SMSPEC", "CSVX.SMSPEC")
            with self.assertRaises(IOError):
                case2 = EclSum.load("Does/not/exist", "CSV.UNSMRY")

            with self.assertRaises(IOError):
                case2 = EclSum.load("CSVX.SMSPEC", "CSVX.UNSMRY")

            case2 = EclSum.load("CSVX.SMSPEC", "CSV.UNSMRY")
            self.assert_solve(case2)
            self.assertEqual(case.unit("FOPR"), "SM3/DAY")

    def test_invalid(self):
        case = create_case()
        with TestAreaContext("sum_invalid"):
            case.fwrite()
            with open("CASE.txt", "w") as f:
                f.write("No - this is not EclKW file ....")
Exemplo n.º 5
0
                            sim_length_days=100,
                            num_report_step=10,
                            num_mini_step=10,
                            func_table={
                                "FOPT": fopt,
                                "FOPR": fopr,
                                "FGPT": fgpt
                            })

        with TestAreaContext("sum_invalid"):
            case.fwrite()
            with open("CASE.txt", "w") as f:
                f.write("No - this is not EclKW file ....")

            with self.assertRaises(IOError):
                case2 = EclSum.load("CSV.SMSPEC", "CASE.txt")

            with self.assertRaises(IOError):
                case2 = EclSum.load("CASE.txt", "CSV.UNSMRY")

            kw1 = EclKW("TEST1", 30, EclDataType.ECL_INT)
            kw2 = EclKW("TEST2", 30, EclDataType.ECL_INT)

            with openFortIO("CASE.KW", FortIO.WRITE_MODE) as f:
                kw1.fwrite(f)
                kw2.fwrite(f)

            with self.assertRaises(IOError):
                case2 = EclSum.load("CSV.SMSPEC", "CASE.KW")

            with self.assertRaises(IOError):