예제 #1
0
 def test_segment(self):
     sum = EclSum(self.createTestPath("Statoil/ECLIPSE/Oseberg/F8MLT/F8MLT-F4"))
     segment_vars = sum.keys("SOFR:F-8:*")
     self.assertIn("SOFR:F-8:1", segment_vars)
     for var in segment_vars:
         tmp = var.split(":")
         nr = int(tmp[2])
         self.assertTrue(nr >= 0)
예제 #2
0
 def test_segment(self):
     sum = EclSum(self.createTestPath("Statoil/ECLIPSE/Oseberg/F8MLT/F8MLT-F4"))
     segment_vars = sum.keys("SOFR:F-8:*")
     self.assertIn("SOFR:F-8:1", segment_vars)
     for var in segment_vars:
         tmp = var.split(":")
         nr = int(tmp[2])
         self.assertTrue(nr >= 0)
예제 #3
0
    def test_Heidrun(self):
        sum = EclSum( self.createTestPath("Statoil/ECLIPSE/Heidrun/Summary/FF12_2013B3_CLEAN_RS"))
        self.assertEqual( 452 , len(sum))
        self.assertFloatEqual( 1.8533144e+8 , sum.get_last_value("FOPT"))

        trange = sum.timeRange( start = datetime.date( 2015 , 1 , 1), interval = "1M")
        self.assertTrue( trange[0] == datetime.date( 2016 , 2 , 1 ))
        for t in trange:
            sum.get_interp( "FOPT" , date = t )
        

        with TestAreaContext("csv/export"):
            sum.exportCSV("file.csv")
            input_file = csv.DictReader( open("file.csv"))
            for row in input_file:
                keys = sum.keys( pattern = "W*")
                keys |= sum.keys( pattern = "G")
                
                for key in keys:
                    self.assertTrue( key in row )
                break
예제 #4
0
    def test_restart_mapping(self):
        history = EclSum( self.createTestPath( "Statoil/ECLIPSE/SummaryRestart/iter-1/NOR-2013A_R007-0") )
        total = EclSum( self.createTestPath( "Statoil/ECLIPSE/SummaryRestart/Prediction/NOR-2013A_R007_PRED-0") , include_restart = True)

        history_dates = history.get_dates( )
        total_dates = total.get_dates( )
        for i in range(len(history_dates)):
            self.assertEqual( history_dates[i] , total_dates[i] )

            
        keys = history.keys( pattern = "W*")
        for key in keys:
            if key in total:
                self.assertEqual( history.iget( key , 5 ) , total.iget( key , 5 ))

        self.assertFalse( "WGPR:NOT_21_D" in history )
        self.assertTrue( "WGPR:NOT_21_D" in total )

        self.assertEqual( total.iget( "WGPR:NOT_21_D", 5) , 0) # Default value
예제 #5
0
class EclSumVectorTest(ExtendedTestCase):
    def setUp(self):
        self.test_file = self.createTestPath("Statoil/ECLIPSE/Gurbat/ECLIPSE.SMSPEC")
        self.ecl_sum = EclSum(self.test_file)

    def test_reportOnly_warns(self):
        with warnings.catch_warnings(record=True) as w:
            warnings.simplefilter("always")

            vector = EclSumVector(self.ecl_sum, "FOPT", True)
            assert len(w) == 1
            assert issubclass(w[-1].category, DeprecationWarning)

    def test_basic(self):
        self.assertEqual(512, len(self.ecl_sum.keys()))
        pfx = "EclSum(name"
        self.assertEqual(pfx, repr(self.ecl_sum)[: len(pfx)])
        it = iter(self.ecl_sum)
        t = self.ecl_sum[it.next()]  # EclSumVector
        self.assertEqual(63, len(t))
        self.assertEqual("BARSA", t.unit)
        pfx = "EclSumVector(key = "
        self.assertEqual(pfx, repr(t)[: len(pfx)])
예제 #6
0
class EclSumVectorTest(ExtendedTestCase):
    def setUp(self):
        self.test_file = self.createTestPath(
            "Statoil/ECLIPSE/Gurbat/ECLIPSE.SMSPEC")
        self.ecl_sum = EclSum(self.test_file)

    def test_reportOnly_warns(self):
        with warnings.catch_warnings(record=True) as w:
            warnings.simplefilter("always")

            vector = EclSumVector(self.ecl_sum, "FOPT", True)
            assert len(w) == 1
            assert issubclass(w[-1].category, DeprecationWarning)

    def test_basic(self):
        self.assertEqual(512, len(self.ecl_sum.keys()))
        pfx = 'EclSum(name'
        self.assertEqual(pfx, repr(self.ecl_sum)[:len(pfx)])
        it = iter(self.ecl_sum)
        t = self.ecl_sum[it.next()]  # EclSumVector
        self.assertEqual(63, len(t))
        self.assertEqual('BARSA', t.unit)
        pfx = 'EclSumVector(key = '
        self.assertEqual(pfx, repr(t)[:len(pfx)])