uxarray.Grid#
- class uxarray.Grid(input_obj, **kwargs)#
Unstructured grid topology definition.
Can be used standalone to explore an unstructured grid topology, or can be seen as the property of
uxarray.UxDataset
anduxarray.DataArray
to make them unstructured grid-aware data sets and arrays.- Parameters:
input_obj (xarray.Dataset, ndarray, list, tuple, required) – Input
xarray.Dataset
or vertex coordinates that form faces.gridspec (bool, optional) – Specifies gridspec
islatlon (bool, optional) – Specify if the grid is lat/lon based
isconcave (bool, optional) – Specify if this grid has concave elements (internal checks for this are possible)
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 or recognized
Examples
>>> import uxarray as ux
Open a grid file with uxarray.open_grid():
>>> uxgrid = ux.open_grid("filename.g")
2. Open an unstructured grid dataset file with uxarray.open_dataset(), then access Grid info:
>>> uxds = ux.open_dataset("filename.g")
- __init__(input_obj, **kwargs)#
Methods
__init__
(input_obj, **kwargs)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.
copy
()Returns a deep copy of this grid.
encode_as
(grid_type)Encodes the grid as a new xarray.Dataset per grid format supplied in the grid_type argument.
Attributes
UGRID Attribute
Mesh2
, which indicates the topology data of a 2D unstructured mesh.UGRID Connectivity Variable
Mesh2_edge_nodes
, which maps every edge to the two nodes that it connects.UGRID Connectivity Variable
Mesh2_face_edges
, which maps every face to its edges.UGRID Connectivity Variable
Mesh2_face_nodes
, which maps each face to its corner nodes.UGRID Coordinate Variable
Mesh2_face_x
, which contains the longitude of each face center.UGRID Coordinate Variable
Mesh2_face_y
, which contains the latitude of each face center.Mesh2_node_cart_x
Coordinate Variable
Mesh2_node_cart_x
, which contains the x location in meters.Mesh2_node_cart_y
Coordinate Variable
Mesh2_node_cart_y
, which contains the y location in meters.Mesh2_node_cart_z
Coordinate Variable
Mesh2_node_cart_z
, which contains the z location in meters.UGRID Coordinate Variable
Mesh2_node_x
, which contains the longitude of each node in degrees.UGRID Coordinate Variable
Mesh2_node_y
, which contains the latitude of each node.face_areas
Declare face_areas as a property.
Dimension
nMaxMesh2_face_edges
, which represents the maximum number of edges per face.UGRID Dimension
nMaxMesh2_face_nodes
, which represents the maximum number of faces nodes that a face may contain.UGRID Dimension
nMesh2_edge
, which represents the total number of edges.UGRID Dimension
nMesh2_face
, which represents the total number of faces.UGRID Dimension
nMesh2_node
, which represents the total number of nodes.Dimension Variable
nNodes_per_face
, which contains the number of non-fill-value nodes per face.Dictionary of parsed attributes from the source grid.