Internal API#
This page shows already-implemented Uxarray internal API functions. You can also check the UXarray Milestones and UXarray RoadMap for a high level understanding of UXarray’s future function development milestones and roadmap. Please let us know if you have any feedback!
UxDataset#
The uxarray.UxDataset
class inherits from xarray.Dataset
. Below is a list of
features explicitly added to work on Unstructured Grids.
Class#
|
A |
Attributes#
Methods#
Override to make sure the result is an instance of |
|
|
Add an array to this dataset. |
|
Override to make the result a complete instance of |
Override to make the result an instance of |
|
|
Override to make the result an |
|
Override to make the result a complete instance of |
|
Override to make the result a complete instance of |
UxDataArray#
The uxarray.UxDataArray
class inherits from xarray.DataArray
. Below is a list of
features explicitly added to work on Unstructured Grids.
Class#
|
N-dimensional |
Attributes#
Methods#
|
Override to make the result a |
|
Override to make the result a complete instance of |
|
Override to make the result a complete instance of |
Returns whether the data stored is Face Centered (i.e. contains the "n_face" dimension). |
|
Returns whether the data stored is Node Centered (i.e. contains the "n_node" dimension). |
|
|
Slices a |
Grid#
Class#
|
Represents a two-dimensional unstructured grid encoded following the UGRID conventions and provides grid-specific functionality. |
Operators#
|
Two grids are equal if they have matching grid topology variables, coordinates, and dims all of which are equal. |
|
Two grids are not equal if they have differing grid topology variables, coordinates, or dims. |
Helpers#
Connectivity#
Converts a given dense matrix connectivity to a sparse matrix format where the locations of non fill-value entries are stored using COO (coordinate list) standard. |
|
Replaces all instances of the the current fill value ( |
|
Constructs the UGRID connectivity variable ( |
|
Builds the Grid.node_faces_connectivity: integer DataArray of size (n_node, n_max_faces_per_node) (optional) A DataArray of indices indicating faces that are neighboring each node. |
|
Helper for ( |
|
Constructs the UGRID connectivity variable ( |
|
Constructs the UGRID connectivity variable ( |
|
Constructs the connectivity variable ( |
Geometry#
Coordinates#
A helper function that populates the xyz attribute in UXarray.Grid._ds. |
|
Helper function that populates the longitude and latitude and store it into the |
|
Finds the centroids of faces using cartesian averaging based off the vertices. |
|
Constructs the xyz centroid coordinate for each face using Cartesian Averaging. |
|
Sets the longitude range to [-180, 180] for all longitude variables. |
|
Finds the centroids using cartesian averaging of the edges based off the vertices. |
|
Constructs the xyz centroid coordinate for each edge using Cartesian Averaging. |
Arcs#
Calculate the angle between two 3D vectors u and v in radians. |
|
|
Determine the pole latitude based on the latitudes of two points on a Great Circle Arc (GCA). |
Utils#
Solve for the intersection point between a great circle arc and a constant latitude. |
|
|
Calculate the inverse Jacobian matrix for a given set of parameters. |
Validation#
Check if all nodes are referenced by at least one element. |
|
Check if there are duplicate nodes in the mesh. |
|
Check if each face area is greater than our constant ERROR_TOLERANCE. |
Accurate Computing Utils#
|
Error-free transformation for the FMA operation. |
Error-free transformation of the product of two floating-point numbers such that a * b = x + y exactly. |
|
Compute a fast error-free transformation of the sum of two floating- point numbers. |
|
|
Error-free transformation of the sum of two floating-point numbers such that a + b = x + y exactly |
Error-free transformation of the product of two floating-point numbers using FMA, such that a * b = x + y exactly. |
|
Compute the compensated product using Fused Multiply-Add (FMA). |
|
Compute the sum of squares of a vector using a compensated algorithm. |
|
Compute the sum of a vector using a compensated summation algorithm. |
|
Compute the faithful norm of a vector. |
|
Compute the L2 norm (Euclidean norm) of a vector using a compensated algorithm. |
|
Compute the compensated Euclidean norm of a vector. |
|
Compute the square of a number with a compensation for the round-off error. |
|
Compute the accurate square root of a number with a compensation for round-off error. |
|
Split a floating-point number into two parts: The rounded floating point presentation and its error. |
Remapping#
Nearest Neighbor Remapping between two grids, mapping data that resides on the corner nodes, edge centers, or face centers on the source grid to the corner nodes, edge centers, or face centers of the destination grid. |
|
Nearest Neighbor Remapping implementation for |
|
Nearest Neighbor Remapping implementation for |
|
|
Inverse Distance Weighted Remapping between two grids. |
|
Inverse Distance Weighted Remapping implementation for |
|
Inverse Distance Weighted implementation for |
Grid Parsing and Encoding#
UGRID#
|
UGRID file reader. |
Encodes UGRID file . |
|
Check mesh topology and dimension. |
|
|
Checks whether a given |
MPAS#
|
Function to read in a MPAS Grid dataset and encode either the Primal or Dual Mesh in the UGRID conventions. |
|
Encodes the MPAS Primal-Mesh in the UGRID conventions. |
|
Encodes the MPAS Dual-Mesh in the UGRID conventions. |
|
Replaces the padded values in verticesOnCell defined by nEdgesOnCell with a fill-value. |
|
Replaces all instances of a zero (invalid/missing MPAS value) with a fill value. |
Exodus#
|
Exodus file reader. |
|
Encodes an Exodus file. |
|
Helper function to get exodus element type from number of nodes. |
SCRIP#
|
If input dataset ( |
|
Function to reassign lat/lon variables to node variables. |
Function to reassign UGRID formatted variables to SCRIP formatted variables. |
Shapefile#
|
Read shape file. |
Vertices#
Create a grid with faces constructed from vertices specified by the given argument. |
Utils#
|
Checks input and contents to determine grid type. |
Core Utils#
|
Given a dataset containing variables residing on an unstructured grid, remaps the original dimension name to match the UGRID conventions (i.e. "nCell": "n_face"). |
Visualization#
|
Helper function for plotting coordinates (node, edge, face) as Points with Holoviews. |
Helper function for plotting data variables as Points, either on the Nodes, Face Centers, or Edge Centers. |
|
|
Implementation of Polygon Rasterization. |
|
Implementation of Point Rasterization. |
Slicing#
|
Slices (indexes) an unstructured grid given a list/array of node indices, returning a new Grid composed of elements that contain the nodes specified in the indices. |
Subsetting#
Accessor for performing unstructured grid subsetting, accessed through |
|
Accessor for performing unstructured grid subsetting with a data variable, accessed through |
Neighbor#
Populates |
|
Helper for computing the arc-distance between nodes compose each edge. |
|
Populates |
|
Helper for computing the arc-distance between faces that saddle a given edge. |
Gradients#
Helper function for computing the aboslute difference between the data values on each face that saddle each edge. |
|
Helper function for computing the aboslute difference between the data values on each node that saddle each edge. |
|
Helper function for computing the horizontal gradient of a field on each cell using values at adjacent cells. |