Fields#

ModelGrid inherits several useful methods for creating new data fields and adding new data fields to a ModelGrid instance. Methods to add or create a new data array follow the numpy syntax for creating arrays. The following methods create and, optionally, initialize new arrays. The size of the new array is determined by the at keyword, which indicates on which element the array is defined. Methods with the prefix add_ will add the newly created field to the grid, otherwise a newly-created array is not added to the grid.

add_empty

Create and add an uninitialized array of values to the field.

add_field

Add an array of values to the field.

add_ones

Create and add an array of values, initialized to 1, to the field.

add_zeros

Create and add an array of values, initialized to 0, to the field.

delete_field

Erases an existing field.

empty

Uninitialized array whose size is that of the field.

ones

Array, initialized to 1, whose size is that of the field.

zeros

Array, initialized to 0, whose size is that of the field.

at_cell

at_corner

at_face

at_link

at_node

at_patch

field_values

Return the values of a field.

return_array_or_field_values

Return field given a field name, or array of with the correct shape.

size

Return the size of the arrays stored in a group.

keys

Return the field names in a group.

has_group

Check if a group exists.

has_field

Check if a field is in a group.

field_units

Get units for a field.

field_values

Return the values of a field.

groups

List of group names.