flopy.pakbase module
- pakbase module
This module contains the base package class from which all of the other packages inherit from.
- class Package(parent, extension='glo', name='GLOBAL', unit_number=1, filenames=None, allowDuplicates=False)[source]
Bases:
PackageInterface
Base package class from which most other packages are derived.
- Parameters:
parent (object) – Parent model object.
extension (str or list, default "glo") – File extension, without “.”, use list to describe more than one.
name (str or list, default "GLOBAL") – Package name, use list to describe more than one.
unit_number (int or list, default 1) – Unit number, use list to describe more than one.
allowDuplicates (bool, default False) – Allow more than one instance of package in parent.
- static add_to_dtype(dtype, field_names, field_types)[source]
Add one or more fields to a structured array data type
- Parameters:
dtype (numpy.dtype) – Input structured array datatype to add to.
field_types (numpy.dtype or list) – One or more data types. If one data type is supplied, it is repeated for each field name.
- property data_list
- export(f, **kwargs)[source]
Method to export a package to netcdf or shapefile based on the extension of the file name (.shp for shapefile, .nc for netcdf)
- Parameters:
f (str) – filename
kwargs (keyword arguments) –
- modelgridflopy.discretization.Grid instance
user supplied modelgrid which can be used for exporting in lieu of the modelgrid associated with the model object
- Return type:
None or Netcdf object
- static load(f: str | bytes | PathLike, model, pak_type, ext_unit_dict=None, **kwargs)[source]
Default load method for standard boundary packages.
- property name
- property package_type
- property parent
- plot(**kwargs)[source]
Plot 2-D, 3-D, transient 2-D, and stress period list (MfList) package input data
- Parameters:
**kwargs (dict) –
- filename_basestr
Base file name that will be used to automatically generate file names for output image files. Plots will be exported as image files if file_name_base is not None. (default is None)
- file_extensionstr
Valid matplotlib.pyplot file extension for savefig(). Only used if filename_base is not None. (default is ‘png’)
- mflayint
MODFLOW zero-based layer number to return. If None, then all all layers will be included. (default is None)
- kperint
MODFLOW zero-based stress period number to return. (default is zero)
- keystr
MfList dictionary key. (default is None)
- Returns:
axes – Empty list is returned if filename_base is not None. Otherwise a list of matplotlib.pyplot.axis are returned.
- Return type:
Notes
Examples
>>> import flopy >>> ml = flopy.modflow.Modflow.load('test.nam') >>> ml.dis.plot()
- property plottable
- to_shapefile(filename, **kwargs)[source]
Export 2-D, 3-D, and transient 2-D model data to shapefile (polygons). Adds an attribute for each layer in each data array
- Parameters:
filename (str) – Shapefile name to write
- Return type:
None
Notes
Examples
>>> import flopy >>> ml = flopy.modflow.Modflow.load('test.nam') >>> ml.lpf.to_shapefile('test_hk.shp')
- class PackageInterface[source]
Bases:
object
- check(f=None, verbose=True, level=1, checktype=None)[source]
Check package data for common errors.
- Parameters:
f (str or file handle) – String defining file name or file handle for summary file of check method output. If a sting is passed a file handle is created. If f is None, check method does not write results to a summary file. (default is None)
verbose (bool) – Boolean flag used to determine if check method results are written to the screen
level (int) – Check method analysis level. If level=0, summary checks are performed. If level=1, full checks are performed.
checktype (check) – Checker type to be used. By default class check is used from check.py.
- Return type:
None
Examples
>>> import flopy >>> m = flopy.modflow.Modflow.load('model.nam') >>> m.dis.check()
- abstract property data_list
- property has_stress_period_data
- abstract property name
- abstract property package_type
- abstract property parent
- abstract property plottable