Extend Completion class implementation (#54)

* Extend Completion class implementation

Added access to several variables from the completion class. The Well
interface has been changed so that completions for any timestep can be
accessed rather than just the last.

* Bump version to 0.0.3

* Removed single space
This commit is contained in:
Jens Gåsemyr Magnus
2017-12-05 17:48:07 +01:00
committed by GitHub
parent 69f74c858a
commit 524af0dcf0
7 changed files with 129 additions and 25 deletions

View File

@@ -2,10 +2,10 @@
"""
from .schedule import Well
from .schedule import Well, Completion
from .libsunbeam import action
from .config import EclipseConfig
from .parser import parse_deck, parse
__version__ = '0.0.1'
__version__ = '0.0.3'
__license__ = 'GNU General Public License version 3'

View File

@@ -31,6 +31,9 @@ class Well(object):
def __repr__(self):
return 'Well(name = "%s")' % self.name
def completions(self, timestep):
return map(Completion, self._completions(timestep))
@staticmethod
def defined(timestep):
def fn(well): return well.isdefined(timestep)
@@ -66,6 +69,36 @@ class Well(object):
return fn
@delegate(lib.Completion)
class Completion(object):
@property
def pos(self):
return self.I, self.J, self.K
def __repr__(self):
return 'Completion(number = {})'.format(self.number)
# using the names flowing and closed for functions that test if a well is
# opened or closed at some point, because we might want to use the more
# imperative words 'open' and 'close' (or 'shut') for *changing* the status
# later
@staticmethod
def flowing():
def fn(completion): return completion.state == 'OPEN'
return fn
@staticmethod
def closed():
def fn(completion): return completion.state == 'SHUT'
return fn
@staticmethod
def auto():
def fn(completion): return completion.state == 'AUTO'
return fn
@delegate(lib.Group)
class Group(object):
def __init__(self, _, schedule, timestep):