flopy.utils.datautil module¶
-
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
-
class
MultiListIter
(multi_list, detailed_info=False, iter_leaf_lists=False)[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’
-
consistent_delim
= False¶
-
delimiter_list
= {',': 1}¶
-
delimiter_used
= None¶
-
line_num
= 0¶
-
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
= {'"', "'"}¶
-
save_array
(filename, multi_array)[source]