Exemplo n.º 1
0
    def test_report_list(self):
        rlist0 = list(range(63))
        self.report_list_file_test(self.u_file, rlist0)

        rlist0 = [0]
        self.report_list_file_test(self.xfile0, rlist0)

        f = EclFile(self.grid_file)
        with self.assertRaises(ArgumentError): #argumentError wraps the expected TypeError
            EclFile.file_report_list(f)
Exemplo n.º 2
0
    def test_report_list(self):
        rlist0 = list(range(63))
        self.report_list_file_test(self.u_file, rlist0)

        rlist0 = [0]
        self.report_list_file_test(self.xfile0, rlist0)

        f = EclFile(self.grid_file)
        with self.assertRaises(
                ArgumentError):  #argumentError wraps the expected TypeError
            EclFile.file_report_list(f)
Exemplo n.º 3
0
    def report_list_file_test(self, fname, rlist0):
        rlist = EclFile.file_report_list(fname)
        self.assertListEqual(rlist, rlist0)

        f = EclFile(fname)
        rlist = f.report_list
        self.assertListEqual(rlist, rlist0)
Exemplo n.º 4
0
    def report_list_file_test(self, fname, rlist0):
        rlist = EclFile.file_report_list(fname)
        self.assertListEqual(rlist, rlist0)

        f = EclFile(fname)
        rlist = f.report_list
        self.assertListEqual(rlist, rlist0)
Exemplo n.º 5
0
def rstdates(eclfiles):
    """Return a list of datetime objects for the available dates in the RST file"""
    report_indices = EclFile.file_report_list(eclfiles.get_rstfilename())
    return [
        eclfiles.get_rstfile().iget_restart_sim_time(index).date()
        for index in range(0, len(report_indices))
    ]
Exemplo n.º 6
0
def get_available_rst_dates(eclfiles):
    """Return a list of datetime objects for the available dates in the RST file"""
    report_indices = EclFile.file_report_list(eclfiles.get_rstfilename())
    logger.info(
        "Restart report indices (count %s): %s",
        str(len(report_indices)),
        str(report_indices),
    )
    return [
        eclfiles.get_rstfile().iget_restart_sim_time(index).date()
        for index in range(0, len(report_indices))
    ]
Exemplo n.º 7
0
def get_restart_indices(rstfilename: str) -> list:
    """Extract a list of RST indices for a filename"""
    if Path(rstfilename).exists():
        # This function segfaults if file does not exist
        return EclFile.file_report_list(str(rstfilename))
    raise FileNotFoundError(f"{rstfilename} not found")
Exemplo n.º 8
0
def get_restart_indices(rstfilename):
    """Extract a list of RST indices for a filename"""
    return EclFile.file_report_list(rstfilename)