flopy.utils.datautil module

class ArrayIndexIter(array_shape, index_as_tuple=False)[source]

Bases: object

next()
class ConstIter(value)[source]

Bases: object

next()
class DatumUtil[source]

Bases: object

static is_basic_type(obj)[source]
static is_float(str)[source]
static is_int(str)[source]
class FileIter(file_path)[source]

Bases: object

close()[source]
next()
class MultiList(mdlist=None, shape=None, callback=None)[source]

Bases: object

Class for storing objects in an n-dimensional list which can be iterated through as a single list.

Parameters:
  • mdlist (list) – multi-dimensional list to initialize the multi-list. either mdlist or both shape and callback must be specified
  • shape (tuple) – shape of the multi-list
  • callback (method) – callback method that takes a location in the multi-list (tuple) and returns an object to be stored at that location in the multi-list
increment_dimension : (dimension, callback)

increments the size of one of the two dimensions of the multi-list

build_list : (callback)

builds a multi-list of shape self.list_shape, constructing objects for the list using the supplied callback method

first_item : () : object

gets the first entry in the multi-list

get_total_size : () : int

returns the total number of entries in the multi-list

in_shape : (indexes) : boolean

returns whether a tuple of indexes are valid indexes for the shape of the multi-list

inc_shape_idx : (indexes) : tuple

given a tuple of indexes pointing to an entry in the multi-list, returns a tuple of indexes pointing to the next entry in the multi-list

first_index : () : tuple

returns a tuple of indexes pointing to the first entry in the multi-list

indexes : (start_indexes=None, end_indexes=None) : iter(tuple)

returns an iterator that iterates from the location in the multi-list defined by start_indexes to the location in the multi-list defined by end_indexes

elements : () : iter(object)

returns an iterator that iterates over each object stored in the multi-list

build_list(callback)[source]
elements()[source]
first_index()[source]
first_item()[source]
get_total_size()[source]
in_shape(indexes)[source]
inc_shape_idx(indexes)[source]
increment_dimension(dimension, callback)[source]
indexes(start_indexes=None, end_indexes=None)[source]
nth_index(n)[source]
class MultiListIter(multi_list, detailed_info=False, iter_leaf_lists=False)[source]

Bases: object

next()
class NameIter(name, first_not_numbered=True)[source]

Bases: object

next()
class PathIter(path, first_not_numbered=True)[source]

Bases: object

next()
class PyListUtil(path=None, max_error=0.01)[source]

Bases: object

Class contains miscellaneous methods to work with and compare python lists

Parameters:
  • path (string) – file path to read/write to
  • max_error (float) – maximum acceptable error when doing a compare of floating point numbers
is_empty_list : (current_list : list) : boolean

determines if an n-dimensional list is empty

con_convert : (data : string, data_type : type that has conversion
operation) : boolean

returns true if data can be converted into data_type

max_multi_dim_list_size : (current_list : list) : boolean

determines the max number of items in a multi-dimensional list ‘current_list’

first_item : (current_list : list) : variable

returns the first item in the list ‘current_list’

next_item : (current_list : list) : variable

returns the next item in the list ‘current_list’

array_comp : (first_array : list, second_array : list) : boolean

compares two lists, returns true if they are identical (with max_error)

spilt_data_line : (line : string) : list

splits a string apart (using split) and then cleans up the results dealing with various MODFLOW input file releated delimiters. returns the delimiter type used.

clean_numeric : (text : string) : string

returns a cleaned up version of ‘text’ with only numeric characters

save_array_diff : (first_array : list, second_array : list,
first_array_name : string, second_array_name : string)

saves lists ‘first_array’ and ‘second_array’ to files first_array_name and second_array_name and then saves the difference of the two arrays to ‘debug_array_diff.txt’

save_array(filename : string, multi_array : list)[source]

saves ‘multi_array’ to the file ‘filename’

array_comp(first_array, second_array)[source]
static clean_numeric(text)[source]
consistent_delim = False
delimiter_list = {',': 1}
delimiter_used = None
static first_item(current_list)[source]
static has_one_item(current_list)[source]
static is_empty_list(current_list)[source]
line_num = 0
static max_multi_dim_list_size(current_list)[source]
static next_item(current_list, new_list=True, nesting_change=0, end_of_list=True)[source]
static next_list(current_list)[source]
numeric_chars = {'-': 0, '.': 0, '0': 0, '1': 0, '2': 0, '3': 0, '4': 0, '5': 0, '6': 0, '7': 0, '8': 0, '9': 0}
quote_list = {'"', "'"}
static reset_delimiter_used()[source]
save_array(filename, multi_array)[source]
save_array_diff(first_array, second_array, first_array_name, second_array_name)[source]
static split_data_line(line, external_file=False, delimiter_conf_length=15)[source]
clean_name(name)[source]
find_keyword(arr_line, keyword_dict)[source]
max_tuple_abs_size(some_tuple)[source]