7.3.9. Top Module

parflow.tools.top.compute_top(mask)

Python version of the C ComputeTop function.

Computes the top indices of the computation domain as defined by the mask values. Mask has values 0 outside of domain so first non-zero entry is the top.

Parameters:

mask (numpy.ndarray) – mask for the computation domain with shape (nz, nx, ny)

Returns:

A new numpy ndarray with dimensions (1, mask.shape[0], mask.shape[1]) with (z) indices of the top surface for each i, j location.

parflow.tools.top.extract_top(data, top)

Python version of the C ExtractTop function.

Extracts the top values of a dataset based on a top dataset (which contains the z indices that define the top of the domain).

Parameters:
  • data (numpy.ndarray) – array of data values with shape (nz, nx, ny)

  • top (numpy.ndarray) – array of z indices for each i, j location with shape (1, nx, ny)

Returns:

Returns a ndarray with top values extracted for each i,j location.

Raises:

ValueError – If a z index in top is outside the range of nz.