Skip to content

basic_tools⚓︎

Collection of simple, yet useful Python tools

index2d(list2d, value) ⚓︎

Search in a 2D list for pattern or value and return is (i, j) index. If the pattern/value is not found, (None, None) is returned

Examples:

>>> l = [['string1', 1], ['string2', 2]]
>>> print index2d(l, 'string1')
(0, 0)

Parameters:

Name Type Description Default
list2d list of lists

2D list.

required
value object

Pattern or value to search for.

required

Returns:

Name Type Description
ind tuple

Indices (i, j) of the value.

read_file(val_type, filename) ⚓︎

Read an eclipse file with specified keyword.

Examples:

>>> read_file('PERMX','filename.permx')

Parameters:

Name Type Description Default
val_type

keyword or property

required
filename

the file that is read

required

Returns:

Name Type Description
values

a vector with values for each cell

write_file(filename, val_type, data) ⚓︎

Write an eclipse file with specified keyword.

Examples:

>>> write_file('filename.permx','PERMX',data_vec)

Parameters:

Name Type Description Default
filename

the file that is read

required
val_type

keyword or property

required
data

data written to file

required