uxarray.grid.Grid#

class uxarray.grid.Grid(dataset, **kwargs)#

Examples

Open an exodus file with Uxarray Grid object

>>> xarray_obj = xr.open_dataset("filename.g")
>>> mesh = ux.Grid(xarray_obj)

Encode as a xarray.Dataset in the UGRID format

>>> mesh.encode_as("ugrid")
__init__(dataset, **kwargs)#

Initialize grid variables, decide if loading happens via file, verts or gridspec.

Parameters:
  • dataset (xarray.Dataset, ndarray, list, tuple, required) – Input xarray.Dataset or vertex coordinates that form one face.

  • islatlon (bool, optional) – Specify if the grid is lat/lon based

  • concave (bool, optional) – Specify if this grid has concave elements (internal checks for this are possible)

  • gridspec (bool, optional) – Specifies gridspec

  • mesh_type (str, optional) – Specify the mesh file type, eg. exo, ugrid, shp, mpas, etc

  • use_dual (bool, optional) – Specify whether to use the primal (use_dual=False) or dual (use_dual=True) mesh if the file type is mpas

Raises:

RuntimeError – If specified file not found

Methods

__init__(dataset, **kwargs)

Initialize grid variables, decide if loading happens via file, verts or gridspec.

calculate_total_face_area([quadrature_rule, ...])

Function to calculate the total surface area of all the faces in a mesh.

compute_face_areas([quadrature_rule, order])

Face areas calculation function for grid class, calculates area of all faces in the grid.

encode_as(grid_type)

Encodes the grid as a new xarray.Dataset per grid format supplied in the grid_type argument.

integrate(var_ds[, quadrature_rule, order])

Integrates over all the faces of the given mesh.

Attributes

face_areas

Declare face_areas as a property.