flopy.plot.crosssection Module

class flopy.plot.crosssection.ModelCrossSection(ax=None, model=None, dis=None, line=None, xul=None, yul=None, rotation=0.0, extent=None)

Class to create a cross section of the model.

Parameters:

ax : matplotlib.pyplot axis

The plot axis. If not provided it, plt.gca() will be used.

model : flopy.modflow object

flopy model object. (Default is None)

dis : flopy.modflow.ModflowDis object

flopy discretization object. (Default is None)

line : dict

Dictionary with either “row”, “column”, or “line” key. If key is “row” or “column” key value should be the zero-based row or column index for cross-section. If key is “line” value should be an array of (x, y) tuples with vertices of cross-section. Vertices should be in map coordinates consistent with xul, yul, and rotation.

xul : float

x coordinate for upper left corner

yul : float

y coordinate for upper left corner. The default is the sum of the delc array.

rotation : float

Angle of grid rotation around the upper left corner. A positive value indicates clockwise rotation. Angles are in degrees.

extent : tuple of floats

(xmin, xmax, ymin, ymax) will be used to specify axes limits. If None then these will be calculated based on grid, coordinates, and rotation.

contour_array(a, masked_values=None, head=None, **kwargs)

Contour a three-dimensional array.

Parameters:

a : numpy.ndarray

Three-dimensional array to plot.

masked_values : iterable of floats, ints

Values to mask.

head : numpy.ndarray

Three-dimensional array to set top of patches to the minimum of the top of a layer or the head value. Used to create patches that conform to water-level elevations.

**kwargs : dictionary

keyword arguments passed to matplotlib.pyplot.contour

Returns:

contour_set : matplotlib.pyplot.contour

get_extent()

Get the extent of the rotated and offset grid

Return (xmin, xmax, ymin, ymax)

get_grid_line_collection(**kwargs)

Get a LineCollection of the grid

Parameters:

**kwargs : dictionary

keyword arguments passed to matplotlib.collections.LineCollection

Returns:

linecollection : matplotlib.collections.LineCollection

get_grid_patch_collection(zpts, plotarray, **kwargs)

Get a PatchCollection of plotarray in unmasked cells

Parameters:

zpts : numpy.ndarray

array of z elevations that correspond to the x, y, and horizontal distance along the cross-section (self.xpts). Constructed using plotutil.cell_value_points().

plotarray : numpy.ndarray

Three-dimensional array to attach to the Patch Collection.

**kwargs : dictionary

keyword arguments passed to matplotlib.collections.PatchCollection

Returns:

patches : matplotlib.collections.PatchCollection

plot_array(a, masked_values=None, head=None, **kwargs)

Plot a three-dimensional array as a patch collection.

Parameters:

a : numpy.ndarray

Three-dimensional array to plot.

masked_values : iterable of floats, ints

Values to mask.

head : numpy.ndarray

Three-dimensional array to set top of patches to the minimum of the top of a layer or the head value. Used to create patches that conform to water-level elevations.

**kwargs : dictionary

keyword arguments passed to matplotlib.collections.PatchCollection

Returns:

patches : matplotlib.collections.PatchCollection

plot_bc(ftype=None, package=None, kper=0, color=None, head=None, **kwargs)

Plot boundary conditions locations for a specific boundary type from a flopy model

Parameters:

ftype : string

Package name string (‘WEL’, ‘GHB’, etc.). (Default is None)

package : flopy.modflow.Modflow package class instance

flopy package class instance. (Default is None)

kper : int

Stress period to plot

color : string

matplotlib color string. (Default is None)

head : numpy.ndarray

Three-dimensional array to set top of patches to the minimum of the top of a layer or the head value. Used to create patches that conform to water-level elevations.

**kwargs : dictionary

keyword arguments passed to matplotlib.collections.PatchCollection

Returns:

patches : matplotlib.collections.PatchCollection

plot_discharge(frf, fff, flf=None, head=None, kstep=1, hstep=1, normalize=False, **kwargs)

Use quiver to plot vectors.

Parameters:

frf : numpy.ndarray

MODFLOW’s ‘flow right face’

fff : numpy.ndarray

MODFLOW’s ‘flow front face’

flf : numpy.ndarray

MODFLOW’s ‘flow lower face’ (Default is None.)

head : numpy.ndarray

MODFLOW’s head array. If not provided, then will assume confined conditions in order to calculated saturated thickness.

kstep : int

layer frequency to plot. (Default is 1.)

hstep : int

horizontal frequency to plot. (Default is 1.)

normalize : bool

boolean flag used to determine if discharge vectors should be normalized using the magnitude of the specific discharge in each cell. (default is False)

kwargs : dictionary

Keyword arguments passed to plt.quiver()

Returns:

quiver : matplotlib.pyplot.quiver

Vectors

plot_fill_between(a, colors=['blue', 'red'], masked_values=None, head=None, **kwargs)

Plot a three-dimensional array as lines.

Parameters:

a : numpy.ndarray

Three-dimensional array to plot.

masked_values : iterable of floats, ints

Values to mask.

head : numpy.ndarray

Three-dimensional array to set top of patches to the minimum of the top of a layer or the head value. Used to create patches that conform to water-level elevations.

**kwargs : dictionary

keyword arguments passed to matplotlib.pyplot.plot

Returns:

plot : list containing matplotlib.fillbetween objects

plot_grid(**kwargs)

Plot the grid lines.

Parameters:

kwargs : ax, colors. The remaining kwargs are passed into the

the LineCollection constructor.

Returns:

lc : matplotlib.collections.LineCollection

plot_ibound(ibound=None, color_noflow='black', color_ch='blue', head=None, **kwargs)

Make a plot of ibound. If not specified, then pull ibound from the self.model

Parameters:

ibound : numpy.ndarray

ibound array to plot. (Default is ibound in ‘BAS6’ package.)

color_noflow : string

(Default is ‘black’)

color_ch : string

Color for constant heads (Default is ‘blue’.)

head : numpy.ndarray

Three-dimensional array to set top of patches to the minimum of the top of a layer or the head value. Used to create patches that conform to water-level elevations.

**kwargs : dictionary

keyword arguments passed to matplotlib.collections.PatchCollection

Returns:

patches : matplotlib.collections.PatchCollection

plot_surface(a, masked_values=None, **kwargs)

Plot a two- or three-dimensional array as line(s).

Parameters:

a : numpy.ndarray

Two- or three-dimensional array to plot.

masked_values : iterable of floats, ints

Values to mask.

**kwargs : dictionary

keyword arguments passed to matplotlib.pyplot.plot

Returns:

plot : list containing matplotlib.plot objects

set_zcentergrid(vs)

Get an array of z elevations at the center of a cell that is based on minimum of cell top elevation (self.elev) or passed vs numpy.ndarray

Parameters:

vs : numpy.ndarray

Three-dimensional array to plot.

Returns:

zcentergrid : numpy.ndarray

set_zpts(vs)

Get an array of z elevations based on minimum of cell elevation (self.elev) or passed vs numpy.ndarray

Parameters:

vs : numpy.ndarray

Three-dimensional array to plot.

Returns:

zpts : numpy.ndarray