gsflow.modflow.mfag Module

class gsflow.modflow.mfag.ModflowAg(model, options=None, time_series=None, well_list=None, pond_list=None, irrdiversion=None, irrwell=None, irrpond=None, supwell=None, extension='ag', unitnumber=None, filenames=None, nper=0)[source]

The ModflowAg class is used to build read, write, and edit data from the MODFLOW-NWT AG package.

Parameters
modelgsflow.modflow.Modflow object

model object

optionsflopy.utils.OptionBlock object

option block object

time_seriesnp.recarray

numpy recarray for the time series block

well_listnp.recarray

recarray of the well_list block

irrdiversiondict {per: np.recarray}

dictionary of the irrdiversion block

irrwelldict {per: np.recarray}

dictionary of the irrwell block

irrponddict {per: np.recarray}

dictionary of the irrpond block

supwelldict {per: np.recarray}

dictionary of the supwell block

extensionstr, optional

default is .ag

unitnumberlist, optional

fortran unit number for modflow, default 69

filenameslist, optional

file name for ModflowAwu package to write input

nperint

number of stress periods in the model

Examples

load a ModflowAg file

>>> import gsflow
>>> ml = gsflow.modflow.Modflow('agtest')
>>> ag = gsflow.modflow.ModflowAg.load('test.g', ml, nper=2)
Attributes
data_list
has_stress_period_data
name
package_type
parent
plottable
segment_list

Method to get a unique list of segments from irrdiversion and irrpond

Methods

add_to_dtype(dtype, field_names, field_types)

Add one or more fields to a structured array data type

check(self[, f, verbose, level, checktype])

Check package data for common errors.

export(self, f, \*\*kwargs)

Method to export a package to netcdf or shapefile based on the extension of the file name (.shp for shapefile, .nc for netcdf)

get_default_dtype([maxells, block])

Parameters

get_empty(numrecords[, maxells, block])

Creates an empty record array corresponding to the block data type it is associated with.

load(f, model[, nper, ext_unit_dict])

Method to load the AG package from file

plot(self, \*\*kwargs)

Plot 2-D, 3-D, transient 2-D, and stress period list (MfList) package input data

to_shapefile(self, filename, \*\*kwargs)

Export 2-D, 3-D, and transient 2-D model data to shapefile (polygons).

webdoc(self)

Open the web documentation.

write_file(self[, check])

Write method for ModflowAg

level1_arraylist

static add_to_dtype(dtype, field_names, field_types)

Add one or more fields to a structured array data type

Parameters
dtypenumpy.dtype

Input structured array datatype to add to.

field_namesstr or list

One or more field names.

field_typesnumpy.dtype or list

One or more data types. If one data type is supplied, it is repeated for each field name.

check(self, f=None, verbose=True, level=1, checktype=None)

Check package data for common errors.

Parameters
fstr 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)

verbosebool

Boolean flag used to determine if check method results are written to the screen

levelint

Check method analysis level. If level=0, summary checks are performed. If level=1, full checks are performed.

checktypecheck

Checker type to be used. By default class check is used from check.py.

Returns
None

Examples

>>> import flopy
>>> m = flopy.modflow.Modflow.load('model.nam')
>>> m.dis.check()
export(self, f, **kwargs)

Method to export a package to netcdf or shapefile based on the extension of the file name (.shp for shapefile, .nc for netcdf)

Parameters
fstr

filename

kwargskeyword arguments
modelgridflopy.discretization.Grid instance

user supplied modelgrid which can be used for exporting in lieu of the modelgrid associated with the model object

Returns
None or Netcdf object
static get_default_dtype(maxells=0, block='well')[source]
Parameters
maxellsint

maximum number of irrigation links

blockstr

str which indicates data set valid options are “well” , “tabfile_well” , “timeseries” , “irrdiversion” , “irrwell” , “supwell”

Returns
dtype(list, tuple)
static get_empty(numrecords, maxells=0, block='well')[source]

Creates an empty record array corresponding to the block data type it is associated with.

Parameters
numrecordsint

number of records to create recarray with

maxellsint, optional

maximum number of irrigation links

blockstr

str which indicates data set valid options are “well” , “tabfile_well” , “timeseries” , “irrdiversion” , “irrwell” , “supwell”

Returns:

np.recarray

static load(f, model, nper=0, ext_unit_dict=None)[source]

Method to load the AG package from file

Parameters
fstr

filename

modelgsflow.modflow.Modflow object

model to attach the ag pacakge to

nperint

number of stress periods in model

ext_unit_dictdict, optional
Returns
ModflowAwu object
plot(self, **kwargs)[source]

Plot 2-D, 3-D, transient 2-D, and stress period list (MfList) package input data

Parameters
**kwargsdict
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
axeslist

Empty list is returned if filename_base is not None. Otherwise a list of matplotlib.pyplot.axis are returned.

Examples

>>> import gsflow
>>> ml = gsflow.modflow.Modflow.load('test.nam')
>>> ml.ag.plot()
property segment_list

Method to get a unique list of segments from irrdiversion and irrpond

to_shapefile(self, 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
filenamestr

Shapefile name to write

Returns
None

Examples

>>> import gsflow
>>> ml = gsflow.modflow.Modflow.load('test.nam')
>>> ml.ag.to_shapefile('test_hk.shp')
webdoc(self)

Open the web documentation.

write_file(self, check=False)[source]

Write method for ModflowAg

Parameters
check: bool

not implemented currently