Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions readers/eclipse.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,13 @@ def readEclipse(f, eclipse, extra_keywords=()):
eclipse.mapaxes = readBlock(file)

elif line.startswith('GRIDUNIT'):
eclipse.gridunit = next(file).split()
eclipse.gridunit.pop()
# Eclipse string keywords are conventionally written with
# single quotes (e.g. 'METRES' 'MAP' /). Strip the quotes so
# downstream comparisons against bare values like 'METRES' or
# 'GRID' work whether the file quotes the strings or not.
tokens = next(file).split()
tokens.pop() # drop the trailing '/'
eclipse.gridunit = [t.strip("'\"") for t in tokens]

elif line.startswith('COORD') and 'COORDSYS' not in line:
eclipse.coord = readBlock(file)
Expand Down
105 changes: 105 additions & 0 deletions test/eclipse/simple_cube_quoted_unit.grdecl
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
-- Same numbers as simple_cube.grdecl but with the GRIDUNIT value quoted
-- ('METRES' rather than METRES) -- the convention many real-world tools
-- (e.g. Petrel) emit. The output should be identical to simple_cube.e;
-- if the reader fails to strip the quotes, the unit check misfires and
-- triggers a spurious "unrecognised GRIDUNIT" info note.

SPECGRID
3 3 3 1 F /

GRIDUNIT
'METRES' /

COORD
0.000 0.000 0.000 0.000 0.000 1.000
0.500 0.000 0.000 0.500 0.000 1.000
1.000 0.000 0.000 1.000 0.000 1.000
1.500 0.000 0.000 1.500 0.000 1.000
0.000 0.500 0.000 0.000 0.500 1.000
0.500 0.500 0.000 0.500 0.500 1.000
1.000 0.500 0.000 1.000 0.500 1.000
1.500 0.500 0.000 1.500 0.500 1.000
0.000 1.000 0.000 0.000 1.000 1.000
0.500 1.000 0.000 0.500 1.000 1.000
1.000 1.000 0.000 1.000 1.000 1.000
1.500 1.000 0.000 1.500 1.000 1.000
0.000 1.500 0.000 0.000 1.500 1.000
0.500 1.500 0.000 0.500 1.500 1.000
1.000 1.500 0.000 1.000 1.500 1.000
1.500 1.500 0.000 1.500 1.500 1.000
/

ZCORN
0.000 0.000 0.000 0.000 0.000 0.000
0.000 0.000 0.000 0.000 0.000 0.000
0.000 0.000 0.000 0.000 0.000 0.000
0.000 0.000 0.000 0.000 0.000 0.000
0.000 0.000 0.000 0.000 0.000 0.000
0.000 0.000 0.000 0.000 0.000 0.000
0.500 0.500 0.500 0.500 0.500 0.500
0.500 0.500 0.500 0.500 0.500 0.500
0.500 0.500 0.500 0.500 0.500 0.500
0.500 0.500 0.500 0.500 0.500 0.500
0.500 0.500 0.500 0.500 0.500 0.500
0.500 0.500 0.500 0.500 0.500 0.500
0.500 0.500 0.500 0.500 0.500 0.500
0.500 0.500 0.500 0.500 0.500 0.500
0.500 0.500 0.500 0.500 0.500 0.500
0.500 0.500 0.500 0.500 0.500 0.500
0.500 0.500 0.500 0.500 0.500 0.500
0.500 0.500 0.500 0.500 0.500 0.500
1.000 1.000 1.000 1.000 1.000 1.000
1.000 1.000 1.000 1.000 1.000 1.000
1.000 1.000 1.000 1.000 1.000 1.000
1.000 1.000 1.000 1.000 1.000 1.000
1.000 1.000 1.000 1.000 1.000 1.000
1.000 1.000 1.000 1.000 1.000 1.000
1.000 1.000 1.000 1.000 1.000 1.000
1.000 1.000 1.000 1.000 1.000 1.000
1.000 1.000 1.000 1.000 1.000 1.000
1.000 1.000 1.000 1.000 1.000 1.000
1.000 1.000 1.000 1.000 1.000 1.000
1.000 1.000 1.000 1.000 1.000 1.000
1.500 1.500 1.500 1.500 1.500 1.500
1.500 1.500 1.500 1.500 1.500 1.500
1.500 1.500 1.500 1.500 1.500 1.500
1.500 1.500 1.500 1.500 1.500 1.500
1.500 1.500 1.500 1.500 1.500 1.500
1.500 1.500 1.500 1.500 1.500 1.500
/

ACTNUM
1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1
/

PERMX
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9
/

PERMY
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9
/

PERMZ
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9
/

PORO
0.2 0.2 0.4 0.4 0.6 0.6 0.8 0.8 0.5
0.2 0.2 0.4 0.4 0.6 0.6 0.8 0.8 0.5
0.2 0.2 0.4 0.4 0.6 0.6 0.8 0.8 0.5
/

SATNUM
1 1 1 1 1 1 1 1 1
2 2 2 2 2 2 2 2 2
3 3 3 3 3 3 3 3 3
/
10 changes: 10 additions & 0 deletions test/eclipse/tests
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,16 @@ simple_cube_feet_converted:
cli_args: --convert-to-m
gold: simple_cube_feet_converted.e

# Same numbers as simple_cube.grdecl but the GRIDUNIT value is single-quoted
# ('METRES' rather than METRES) -- the convention many real-world tools
# (Petrel, etc.) emit. Output should match simple_cube.e; if the reader
# fails to strip the quotes the unit check would misfire with an
# "unrecognised GRIDUNIT" note.
simple_cube_quoted_unit:
filename: simple_cube_quoted_unit.grdecl
type: exodiff
gold: simple_cube.e

# Z-up convention file (pillar tops at z=1, bots at z=0). em2ex's default
# corner ordering treats this as inverted; --strict-jacobians should error
# out rather than write a mesh
Expand Down
Loading