cpgr / em2ex

Converts reservoir models to Exodus II format
Other
8 stars 4 forks source link

Expands shorthand notation in eclipse file doesn't work! #12

Closed raincoder87 closed 5 years ago

raincoder87 commented 5 years ago

Hi, As Petrel export eclipse file that mostly contains some shorthand notation (N*data ) in many block with the grdecl file. I am trying to use the function processData that was provided in ecilpse reader for expansion, but it doesn't work well. Can you provide more explantion about this point. if you would like, I can share some of the grdecl file. Thanks so much for helping to figure this issue out.

cpgr commented 5 years ago

There isn't a test for this (I will need to add one), but if I modify one of the tests like so

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
27*1
/

PERMX
9*1
1 8*2
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 6*0.3 0.2 0.2
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
/

and run ./em2ex filename.grdecl it works as expected. All of the N*V properties expand as expected.

Can you post a short example of it not working?

cpgr commented 5 years ago

I added a test (test/eclipse/simple_cube_shorthand.grdecl) that has a lot of shorthand notation and confirmed that it gives the same exodus grid as test/eclipse/simple_cube.grdecl.

More generally, the function processData takes a string representing a single line from the eclipse file, and expands that string into a list of strings like so:

sample = '1 5*2 3 2*6 7'
expanded = processData(sample)
print(sample)
print(expanded)

which results in

1 5*2 3 2*6 7
['1', '2', '2', '2', '2', '2', '3', '6', '6', '7']

ie, a 1, five 2's, a 3, two 6's and a 7, as expected

raincoder87 commented 5 years ago

It seems that I used to use an old script. it works now, thanks so much

cpgr commented 5 years ago

No worries. I'll close this issue then