emsarray.conventions.arakawa_c#

Curvilinear Arakawa C grids.

See also

Arakawa grids on Wikipedia

class ArakawaC(dataset, *, coordinate_names=None)#

An Arakawa C grid is a curvilinear orthogonal grid with data defined on grid faces, edges, and nodes. The edges are split in to left and back edges.

There is a topology helper for each of the ArakawaC.face, ArakawaC.left, back, and node grids.

Parameters:
  • dataset (xarray.Dataset) – The dataset containing the Arakawa C grid

  • coordinate_names (dict) – A dict defining which coordinate variables define which grids. The keys are each of ‘face’, ‘left’, ‘back’, or ‘node’; and the values are a two-tuple of strings naming the latitude and longitude coordinate variables for that grid kind:

    coordinate_names = {
        'face': ('y_face', 'x_face'),
        'left': ('y_left', 'x_left'),
        'back': ('y_back', 'x_back'),
        'node': ('y_node', 'x_node'),
    }
    
property face#

Topology for the face grid, an instance of ArakawaCGridTopology.

property left#

Topology for the left edge grid, an instance of ArakawaCGridTopology.

property back#

Topology for the back edge grid, an instance of ArakawaCGridTopology.

property node#

Topology for the node grid, an instance of ArakawaCGridTopology.

Indexing#

Arakawa C grid datasets have four grids: face, left, back, and node. ArakawaCGridKind represents this. Each grid is indexed by a grid kind and two integers i and j. The convention native index type is ArakawaCIndex.

class ArakawaCGridKind(value)#

Araawa C grid datasets can store data on cell faces, left edges, back edges, and nodes. The kind of grid is specified by this enum.

face#

The face grid.

left#

The left edge grid. The left edge i dimension is one larger than for the face i dimension. A face (j, i) will have left edges (j, i) and (j, i + 1)

back#

The back edge grid. The back edge j dimension is one larger than for the face j dimension. A face (j, i) will have back edges (j, i) and (j + 1, i)

node#

The node grid. The node i and j dimensions are one larger than for the face i and j dimensions. A face (j, i) will have nodes (j, i), (j + 1, i), (j, i + 1, and (j + 1, i + 1)

ArakawaCIndex#

The native index type for Arakawa C grids is a tuple with three elements: (kind, j, i).

alias of Tuple[ArakawaCGridKind, int, int]

Topology#

class ArakawaCGridTopology(dataset, *, latitude, longitude)#

A topology helper to deal with grid coordinates.

Parameters:
  • dataset (xarray.Dataset) – The Arakawa C gridded Dataset to introspect.

  • latitude (Hashable) – The name of the latitude coordinate variable.

  • longitude (Hashable) – The name of the longitude coordinate variable.

property latitude#

The latitude DataArray coordinate variable.

property longitude#

The logitude DataArray coordinate variable.

property j_dimension#

The name of the j dimension for this grid kind.

property i_dimension#

The name of the i dimension for this grid kind.

property shape#

The shape of this grid, as a tuple of (j, i).

property size#

The size of this grid, j * i.

Functions#

c_mask_from_centres(face_mask, dimensions, coords=None)#

Create a mask for a SHOC standard file given a mask array for the cell centres to include. The full mask will include the centres, edges, and nodes.