Skip to content

Commit

Permalink
fixed error in type and improved error reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
Pål Grønås Drange authored and Pål Grønås Drange committed Mar 31, 2017
1 parent 76dcc5c commit c22ab23
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions python/python/ert/ecl/ecl_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -1063,12 +1063,15 @@ def create3D( self , ecl_kw , default = 0):
if self.active( global_index = global_index ):
array[global_index] = kwa[data_index]
data_index += 1

array = array.reshape( [self.getNX() , self.getNY() , self.getNZ()] , order = 'F')
return array
else:
raise ValueError("Keyword: %s has invalid size(%d), must be either nactive:%d or nx*ny*nz:%d" % (ecl_kw.getName() , len(ecl_kw) , self.getNumActive() , self.getGlobalSize()))

err_msg_fmt = 'Keyword "%s" has invalid size %d; must be either nactive=%d or nx*ny*nz=%d'
err_msg = err_msg_fmt % (ecl_kw, len(ecl_kw), self.getNumActive(),
self.getGlobalSize())
raise ValueError(err_msg)

def save_grdecl(self , pyfile, output_unit = EclUnitTypeEnum.ECL_METRIC_UNITS):
"""
Will write the the grid content as grdecl formatted keywords.
Expand Down
2 changes: 1 addition & 1 deletion python/python/ert/ecl/ecl_kw.py
Original file line number Diff line number Diff line change
Expand Up @@ -963,7 +963,7 @@ def str(self , width = 5 , max_lines = 10 , fmt = None):
if max_lines is None or lines <= max_lines:
s += self.str_data( width , 0 , len(self) , fmt)
else:
s1 = width * max_lines / 2
s1 = width * max_lines // 2
s += self.str_data( width , 0 , s1 , fmt)
s += " .... \n"
s += self.str_data( width , len(self) - s1 , len(self) , fmt)
Expand Down

0 comments on commit c22ab23

Please sign in to comment.