multimodemodel.Grid

multimodemodel.Grid#

class multimodemodel.Grid(x, y, z=None, mask=None, dx=None, dy=None, dz=None)[source]#

Grid information.

A Grid object holds all information about coordinates of the grid points and grid spacing, i.e. size of the grid box faces. For convenience there are following class methods:

Parameters:
  • method) ((of the __init__)

  • x (ndarray) – 2D np.ndarray of x-coordinates on grid

  • y (ndarray) – 2D np.ndarray of y-coordinates on grid

  • z (Array, default None) – 1D Array of z coordinates.

  • mask (Array = None) – optional. Ocean mask, 1 where ocean is, 0 where land is. Default is a rectangular domain with closed boundaries.

  • dx (Optional[np.ndarray] = None) – Initialization of dx

  • dy (Optional[np.ndarray] = None) – Initialization of dy

  • dz (Optional[np.ndarray] = None) – Initialization of dz

Variables:
  • dx (Array) – Grid spacing in x.

  • dy (Array) – Grid spacing in y.

  • dz (Array) – Grid spacing in z.

  • mask (Array) – optional. Ocean mask, 1 where ocean is, 0 where land is. Default is a rectangular domain with closed boundaries.

  • shape (tuple[int]) – Shape of the grid data.

  • ndim (int:) – Number of dimensions

  • dim_x (int) – Axis index of x dimension.

  • dim_y (int) – Axis index of y dimension.

  • dim_z (int) – Axis index of z dimension.

Raises:

ValueError – Raised if the shape of mask does not fit the shape of the grid.

__init__(x, y, z=None, mask=None, dx=None, dy=None, dz=None)[source]#

Initialize self.

Methods

__init__(x, y[, z, mask, dx, dy, dz])

Initialize self.

cartesian(x, y[, z, mask])

Generate a Cartesian grid.

merge(others, merger)

Merge grids.

regular_lat_lon(lon_start, lon_end, ...[, ...])

Generate a regular spherical grid.

split(splitter)

Split grid.

Attributes

dim_x

Return axis of x dimension.

dim_y

Return axis of x dimension.

dim_z

Return axis of x dimension.

ndim

Return number of dimensions.

shape

Return shape tuple of grid.

x

y

z

mask

dx

dy

dz