flopy.utils.utils_def module
Generic classes and utility functions
- class FlopyBinaryData[source]
Bases:
object
The FlopyBinaryData class is a class to that defines the data types for integer, floating point, and character data in MODFLOW binary files. The FlopyBinaryData class is the super class from which the specific derived classes are formed. This class should not be instantiated directly.
- get_open_file_object(fname_or_fobj, read_write='rw')[source]
Returns an open file object for either a file name or open file object.
- get_unitnumber_from_ext_unit_dict(model, pak_class, ext_unit_dict=None, ipakcb=0)[source]
For a given modflow package, defines input file unit number, plus package input and (optionally) output (budget) save file names.
- Parameters:
model (model object) – model for which the unit number is sought.
pak_class (modflow package class for which the unit number is sought.) –
ext_unit_dict (external unit dictionary, optional.) – If not provided, unitnumber and filenames will be returned as None.
ipakcb (int, optional) – Modflow package unit number on which budget is saved. Default is 0, in which case the returned output file is None.
- Returns:
unitnumber (int) – file unit number for the given modflow package (or None)
filenames (list) – list of [package input file name, budget file name],
- get_util2d_shape_for_layer(model, layer=0)[source]
Define nrow and ncol for array (Util2d) shape of a given layer in structured and/or unstructured models.
- totim_to_datetime(totim, start='1-1-1970', timeunit='D')[source]
- Parameters:
- Returns:
out – datetime object calculated from start and totim values
- Return type:
- type_from_iterable(_iter, index=0, _type=<class 'int'>, default_val=0)[source]
Returns value of specified type from iterable.
- Parameters:
_iter (iterable) –
index (int) – Iterable index to try to convert
_type (Python type) –
default_val (default value (0)) –
- Returns:
val
- Return type:
value of type _type, or default_val