Remove python2 adaption
This commit is contained in:
parent
e017195478
commit
08e29defd2
@ -394,7 +394,7 @@ void python::common::export_IO(py::module& m) {
|
||||
|
||||
py::class_<Opm::EclIO::EclFile>(m, "EclFile")
|
||||
.def(py::init<const std::string &, bool>(), py::arg("filename"), py::arg("preload") = false)
|
||||
.def("__get_list_of_arrays", &Opm::EclIO::EclFile::getList)
|
||||
.def_property_readonly("arrays", &Opm::EclIO::EclFile::getList)
|
||||
.def("__contains__", &Opm::EclIO::EclFile::hasKey)
|
||||
.def("__len__", &Opm::EclIO::EclFile::size)
|
||||
.def("count", &Opm::EclIO::EclFile::count)
|
||||
@ -410,10 +410,10 @@ void python::common::export_IO(py::module& m) {
|
||||
.def("__len__", &Opm::EclIO::ERst::numberOfReportSteps)
|
||||
.def("count", &Opm::EclIO::ERst::occurrence_count)
|
||||
.def("__contains", &erst_contains)
|
||||
.def("__get_list_of_arrays", (std::vector< std::tuple<std::string, Opm::EclIO::eclArrType, int64_t> >
|
||||
(Opm::EclIO::ERst::*)(int) ) &Opm::EclIO::ERst::listOfRstArrays)
|
||||
.def("__get_list_of_arrays", (std::vector< std::tuple<std::string, Opm::EclIO::eclArrType, int64_t> >
|
||||
(Opm::EclIO::ERst::*)(int, const std::string&) ) &Opm::EclIO::ERst::listOfRstArrays)
|
||||
.def("arrays", (std::vector< std::tuple<std::string, Opm::EclIO::eclArrType, int64_t> >
|
||||
(Opm::EclIO::ERst::*)(int) ) &Opm::EclIO::ERst::listOfRstArrays)
|
||||
.def("arrays", (std::vector< std::tuple<std::string, Opm::EclIO::eclArrType, int64_t> >
|
||||
(Opm::EclIO::ERst::*)(int, const std::string&) ) &Opm::EclIO::ERst::listOfRstArrays)
|
||||
.def("__get_data", &get_erst_by_index)
|
||||
.def("__get_data", &get_erst_vector);
|
||||
|
||||
@ -446,14 +446,14 @@ void python::common::export_IO(py::module& m) {
|
||||
|
||||
py::class_<Opm::EclIO::ERft>(m, "ERft")
|
||||
.def(py::init<const std::string &>())
|
||||
.def("__get_list_of_rfts", &Opm::EclIO::ERft::listOfRftReports)
|
||||
.def_property_readonly("list_of_rfts", &Opm::EclIO::ERft::listOfRftReports)
|
||||
|
||||
.def("__get_list_of_arrays", (std::vector< std::tuple<std::string, Opm::EclIO::eclArrType, int64_t> >
|
||||
(Opm::EclIO::ERft::*)(int) const) &Opm::EclIO::ERft::listOfRftArrays)
|
||||
(Opm::EclIO::ERft::*)(int) const) &Opm::EclIO::ERft::listOfRftArrays)
|
||||
|
||||
.def("__get_list_of_arrays", (std::vector< std::tuple<std::string, Opm::EclIO::eclArrType, int64_t> >
|
||||
(Opm::EclIO::ERft::*)(const std::string&, int, int, int) const)
|
||||
&Opm::EclIO::ERft::listOfRftArrays)
|
||||
(Opm::EclIO::ERft::*)(const std::string&, int, int, int) const)
|
||||
&Opm::EclIO::ERft::listOfRftArrays)
|
||||
|
||||
.def("__get_data", &get_rft_vector_WellDate)
|
||||
.def("__get_data", &get_rft_vector_Index)
|
||||
|
@ -16,16 +16,6 @@ import datetime
|
||||
# ensure the EclFile class returns normal Python strings in the case of CHAR
|
||||
# arrays. The return value is normal Python list of strings.
|
||||
|
||||
@property
|
||||
def eclfile_get_list_of_arrays(self):
|
||||
|
||||
if sys.version_info.major == 2:
|
||||
rawData = self.__get_list_of_arrays()
|
||||
return [ ( x[0].encode("utf-8"), x[1], x[2] ) for x in rawData ]
|
||||
else:
|
||||
return self.__get_list_of_arrays()
|
||||
|
||||
|
||||
def getitem_eclfile(self, arg):
|
||||
|
||||
if isinstance(arg, tuple):
|
||||
@ -39,15 +29,6 @@ def getitem_eclfile(self, arg):
|
||||
return data
|
||||
|
||||
|
||||
def erst_get_list_of_arrays(self, arg):
|
||||
|
||||
if sys.version_info.major==2:
|
||||
rawData = self.__get_list_of_arrays(arg)
|
||||
return [ ( x[0].encode("utf-8"), x[1], x[2] ) for x in rawData ]
|
||||
else:
|
||||
return self.__get_list_of_arrays(arg)
|
||||
|
||||
|
||||
def getitem_erst(self, arg):
|
||||
|
||||
if not isinstance(arg, tuple):
|
||||
@ -121,15 +102,6 @@ def contains_erft(self, arg):
|
||||
raise ValueError("expecting tuple (wellname, year, month, day) or \
|
||||
(arrayName, wellname, year, month, day) or (arrayName, report_index)")
|
||||
|
||||
@property
|
||||
def erft_list_of_rfts(self):
|
||||
|
||||
if sys.version_info.major==2:
|
||||
data = self.__get_list_of_rfts()
|
||||
return [ ( x[0].encode("utf-8"), x[1], x[2] ) for x in data ]
|
||||
else:
|
||||
return self.__get_list_of_rfts()
|
||||
|
||||
|
||||
def erft_list_of_arrays(self, arg1, arg2 = None):
|
||||
|
||||
@ -138,10 +110,7 @@ def erft_list_of_arrays(self, arg1, arg2 = None):
|
||||
else:
|
||||
data = self.__get_list_of_arrays(str(arg1), int(arg2[0]), int(arg2[1]), int(arg2[2]))
|
||||
|
||||
if sys.version_info.major==2:
|
||||
return [ ( x[0].encode("utf-8"), x[1], x[2] ) for x in data ]
|
||||
else:
|
||||
return data
|
||||
return data
|
||||
|
||||
|
||||
def getitem_erft(self, arg):
|
||||
@ -207,17 +176,14 @@ def ecloutput_write(self, name, array, C0nn=False):
|
||||
|
||||
|
||||
setattr(EclFile, "__getitem__", getitem_eclfile)
|
||||
setattr(EclFile, "arrays", eclfile_get_list_of_arrays)
|
||||
|
||||
setattr(ERst, "__contains__", contains_erst)
|
||||
setattr(ERst, "arrays", erst_get_list_of_arrays)
|
||||
setattr(ERst, "__getitem__", getitem_erst)
|
||||
|
||||
setattr(ESmry, "end_date", esmry_end_date)
|
||||
setattr(ESmry, "__getitem__", getitem_esmry)
|
||||
|
||||
setattr(ERft, "__contains__", contains_erft)
|
||||
setattr(ERft, "list_of_rfts", erft_list_of_rfts)
|
||||
setattr(ERft, "arrays", erft_list_of_arrays)
|
||||
setattr(ERft, "__getitem__",getitem_erft)
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
from opm._common import EModel, eclArrType
|
||||
from opm._common import calc_cell_vol
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user