Skip to content

Commit

Permalink
Merge pull request #78 from equinor/nncrefactor
Browse files Browse the repository at this point in the history
Remove superfluous wrapper in nnc
  • Loading branch information
berland authored Dec 16, 2019
2 parents 47389f8 + 45e5c4b commit ae5a59f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
9 changes: 2 additions & 7 deletions ecl2df/nnc.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from .grid import gridgeometry2df


def nnc2df(eclfiles, coords=False, pillars=False):
def df(eclfiles, coords=False, pillars=False):
"""Produce a Pandas Dataframe with NNC information
A NNC is a pair of cells that are not next to each other
Expand Down Expand Up @@ -210,13 +210,8 @@ def nnc2df_main(args):
logging.getLogger().setLevel(logging.INFO)
logging.getLogger().name = "nnc2df"
eclfiles = EclFiles(args.DATAFILE)
nncdf = nnc2df(eclfiles, coords=args.coords, pillars=args.pillars)
nncdf = df(eclfiles, coords=args.coords, pillars=args.pillars)
if nncdf.empty:
logging.warning("Empty NNC dataframe being written to disk!")
nncdf.to_csv(args.output, index=False)
print("Wrote to " + args.output)


def df(eclfiles, coords=False, pillars=False):
"""Main function for Python API users"""
return nnc2df(eclfiles, coords=coords, pillars=pillars)
6 changes: 3 additions & 3 deletions tests/test_nnc.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
def test_nnc2df():
"""Test that dataframes are produced"""
eclfiles = EclFiles(DATAFILE)
nncdf = nnc.nnc2df(eclfiles)
nncdf = nnc.df(eclfiles)

assert not nncdf.empty
assert "I1" in nncdf
Expand All @@ -41,7 +41,7 @@ def test_nnc2df():
def test_nnc2df_coords():
"""Test that we are able to add coordinates"""
eclfiles = EclFiles(DATAFILE)
gnncdf = nnc.nnc2df(eclfiles, coords=True)
gnncdf = nnc.df(eclfiles, coords=True)
assert not gnncdf.empty
assert "X" in gnncdf
assert "Y" in gnncdf
Expand All @@ -51,7 +51,7 @@ def test_nnc2df_coords():
def test_nnc2df_faultnames():
"""Add faultnames from FAULTS keyword to connections"""
eclfiles = EclFiles(DATAFILE)
nncdf = nnc.nnc2df(eclfiles)
nncdf = nnc.df(eclfiles)
faultsdf = faults.deck2df(eclfiles.get_ecldeck())

merged = pd.merge(
Expand Down

0 comments on commit ae5a59f

Please # to comment.