Exemplo n.º 1
0
Arquivo: case.py Projeto: pgdr/recl
 def restart(self):
     if self._rst:
         return self._rst
     if isfile(self._rst_file):
         self._rst = EclRestartFile(self._rst_file)
         return self._rst
     return None
Exemplo n.º 2
0
    def test_load(self):
        g = EclGrid(self.grid_file)
        f = EclRestartFile(g, self.unrst_file)

        head = f["INTEHEAD"][0]
        self.assertTrue(isinstance(head, EclKW))

        swat = f["SWAT"][0]
        self.assertTrue(isinstance(swat, Ecl3DKW))

        pressure = f["PRESSURE"][0]
        self.assertTrue(isinstance(pressure, Ecl3DKW))
Exemplo n.º 3
0
    def test_headers(self):
        g = EclGrid(self.grid_file)
        f = EclRestartFile(g, self.unrst_file)

        headers = f.headers()
        self.assertEqual(len(headers), 63)

        with self.assertRaises(IndexError):
            f.get_header(1000)

        header = f.get_header(10)
        details = header.well_details()
        self.assertTrue("NXCONZ" in details)
        self.assertTrue("NCWMAX" in details)
Exemplo n.º 4
0
    def test_unified(self):
        g = EclGrid(self.grid_file)
        f_unrst = EclRestartFile(g, self.unrst_file)
        f_x0 = EclRestartFile(g, self.xrst_file0)
        f_x10 = EclRestartFile(g, self.xrst_file10)
        f_x20 = EclRestartFile(g, self.xrst_file20)

        self.assertTrue(f_unrst.unified())
        self.assertFalse(f_x0.unified())
        self.assertFalse(f_x10.unified())
        self.assertFalse(f_x20.unified())

        self.assertEqual(
            [(10, datetime.datetime(2000, 10, 1, 0, 0, 0), 274.0)],
            f_x10.timeList())

        unrst_timeList = f_unrst.timeList()
        self.assertEqual(len(unrst_timeList), 63)
        self.assertEqual(
            (62, datetime.datetime(2004, 12, 31, 0, 0, 0), 1826.0),
            unrst_timeList[62])
Exemplo n.º 5
0
 def test_type(self):
     g = EclGrid(self.grid_file)
     with self.assertRaises(ValueError):
         f = EclRestartFile(g, "NOT_A_RESTART_FILE")
Exemplo n.º 6
0
    if not region_id in result:
        result[region_id] = [[],[],[]]


    result[region_id][0].append(p1)
    result[region_id][1].append(p2)
    result[region_id][2].append(p3)


#-----------------------------------------------------------------

if __name__ == "__main__":
    case = sys.argv[1]
    grid = EclGrid("%s.EGRID" % case)
    rst_file = EclRestartFile(grid, "%s.UNRST" % case)
    init_file = EclFile("%s.INIT" % case)

    # Create PORV keyword where all the inactive cells have been removed.
    pv = grid.compressed_kw_copy( init_file["PORV"][0] )

    # Extract an integer region keyword from the init file
    region_kw = init_file["EQLNUM"][0]


    sim_days = []
    result = {}
    for header in rst_file.headers():
        line = {}
        rst_block = rst_file.restart_view( report_step = header.get_report_step( ) )
        p = rst_block["PRESSURE"][0]