API reference#
This page provides an auto-generated summary of UXarray’s API. For more details and examples, refer to the relevant chapters in the main part of the documentation.
Top Level Functions#
|
Constructs and returns a |
|
Wraps |
|
Wraps |
|
Grid#
Constructors#
|
Represents a two-dimensional unstructured grid encoded following the UGRID conventions and provides grid-specific functionality. |
|
Constructs a |
|
Constructs a |
|
Constructs a |
|
Converts a structured |
|
Create a grid from unstructured points. |
|
Constructs a |
Indexing#
|
Indexes an unstructured grid along a given dimension ( |
Indices for a subset that map each face in the subset back to the original grid |
Dimensions#
Names of all unstructured grid dimensions. |
|
Names and values of all unstructured grid dimensions. |
|
Total number of nodes. |
|
Total number of edges. |
|
Total number of faces. |
|
Maximum number of nodes defining a single face. |
|
Maximum number of edges defining a single face. |
|
Maximum number of neighboring faces surrounding a single face. |
|
Maximum number of edges surrounding a single edge. |
|
Maximum number of faces surrounding a single node. |
|
Maximum number of edges surrounding a single node. |
|
An array containing the maximum number of nodes for each face. |
Spherical Coordinates#
Longitude coordinate of each node (in degrees). |
|
Latitude coordinate of each node (in degrees). |
|
Longitude coordinate of the center of each edge (in degrees). |
|
Latitude coordinate of the center of each edge (in degrees). |
|
Longitude coordinate of the center of each face (in degrees). |
|
Latitude coordinate of the center of each face (in degrees). |
Cartesian Coordinates#
Cartesian x coordinate of each node (in meters). |
|
Cartesian y coordinate of each node (in meters). |
|
Cartesian z coordinate of each node (in meters). |
|
Cartesian x coordinate of the center of each edge (in meters). |
|
Cartesian y coordinate of the center of each edge (in meters). |
|
Cartesian z coordinate of the center of each edge (in meters). |
|
Cartesian x coordinate of the center of each face (in meters). |
|
Cartesian y coordinate of the center of each face (in meters). |
|
Cartesian z coordinate of the center of each face (in meters). |
Connectivity#
Names of all connectivity variables. |
|
Connectivity variable representing the indices of nodes (mesh vertices) that define each face. |
|
Connectivity variable representing the indices of edges that define each face. |
|
Connectivity variable representing the indices of faces that share edges. |
|
Connectivity variable representing the indices of nodes (mesh vertices) that define each edge. |
|
Connectivity variable representing the indices of edges that share at least one node. |
|
Connectivity variable representing the indices of faces that saddle each edge. |
|
Connectivity variable representing the indices of nodes (mesh vertices) that surround each node. |
|
Connectivity variable representing the indices of edges that contain each node. |
|
Connectivity variable representing the indices of faces that share a given node. |
Descriptors#
Names of all descriptor variables. |
|
Area of each face. |
|
Spherical bounds of each face in degrees |
|
Longitude bounds for each face in degrees. |
|
Latitude bounds for each face in degrees. |
|
Arc distance between the two nodes that make up each edge (in radians). |
|
Arc distance between the faces that saddle each edge (in radians). |
|
Indices of faces that touch or cross the antimeridian. |
|
Indices of nodes that border regions not covered by any geometry (holes) in a partial grid. |
|
Indices of edges that border regions not covered by any geometry (holes) in a partial grid. |
|
Indices of faces that border regions not covered by any geometry (holes) in a partial grid. |
|
Boolean indicated whether the Grid partial covers the unit sphere (i.e. contains holes). |
|
Boolean indicated whether the Grid completely covers the unit sphere (i.e. contains no holes). |
|
Boolean indicated whether the Grid is strictly composed of triangular faces. |
|
Maximum Euclidean distance from each face center to its nodes. |
Attributes#
Dictionary of parsed attributes from the source grid. |
Methods#
Returns a deep copy of this grid. |
|
|
Converts all arrays to dask arrays with given chunks across grid dimensions in-place. |
|
Validates the current |
|
Face areas calculation function for grid class, calculates area of all faces in the grid. |
Function to calculate the total surface area of all the faces in a mesh. |
|
Normalizes Cartesian coordinates. |
|
|
Constructs face centers, this method provides users direct control of the method for constructing the face centers, the default method is "cartesian average", but a more accurate method is "welzl" that is based on the recursive Welzl algorithm. |
|
Get the SpatialHash data structure of this Grid that allows for fast face search queries. |
|
Identify which grid faces contain the given point(s). |
Inheritance of Xarray Functionality#
The primary data structures in UXarray, uxarray.UxDataArray
and uxarray.UxDataset
inherit from xarray.DataArray
and
xarray.Dataset
respectively. This means that they contain the same methods and attributes that are present in Xarray, with
new additions and some overloaded as discussed in the next sections. For a detailed list of Xarray specific behavior
and functionality, please refer to Xarray’s documentation.
UxDataArray#
Constructors#
|
Grid informed |
|
Converts a |
|
Loads a data array represented in the HEALPix format into a |
Grid Accessor#
Linked |
UxDataset#
Constructors#
|
Grid informed |
Converts a structured |
|
|
Converts a |
|
Loads a dataset represented in the HEALPix format into a |
Grid Accessor#
Linked |
Conversion Methods#
UXarray provides functionality to convert its unstructured grids representation to other data structures that can be ingested by existing, widely used tools, such as Matplotlib and Cartopy. This allows users to keep using their workflows with such tools.
Grid#
|
Constructs a |
|
Constructs a |
|
Constructs a |
|
Returns an |
UxDataArray#
|
Constructs a |
|
Constructs a |
Rasterizes a data variable stored on the faces of an unstructured grid onto the pixels of the provided Cartopy GeoAxes. |
|
|
Convert a |
UxDataset#
|
Converts a |
Override to make the result an instance of |
Plotting#
UXarray’s plotting API is written using hvPlot. We also support standalone functions for pure Matplotlib and Cartopy workflows.
Grid#
Plotting accessor for |
|
|
Plots the edges of a Grid. |
|
Plots the edges of a Grid. |
|
Generate a point plot for the grid corner nodes. |
|
Generate a point plot for the grid corner nodes. |
|
Wrapper for |
|
Wrapper for |
|
Wrapper for |
|
Wrapper for |
Plots the distribution of the number of nodes per face as a bar plot. |
|
|
Plots a histogram of the face areas using hvplot. |
UxDataArray#
Plotting Accessor for |
|
|
Generated a shaded polygon plot. |
|
Generate a point plot based on the specified grid element type (nodes, faces, or edges) shaded with the data mapped to those elements. |
|
Wrapper for |
|
Wrapper for |
Subsetting#
See also
Grid#
Accessor for performing unstructured grid subsetting, accessed through |
|
|
Subsets an unstructured grid by returning the |
|
Subsets an unstructured grid between two latitude and longitude points which form a bounding box. |
|
Subsets an unstructured grid by returning all elements within some radius (in degrees) from a center coord. |
|
Extracts a subset of the grid by selecting all faces that intersect with a specified line of constant latitude. |
|
Extracts a subset of the grid by selecting all faces that intersect with a specified line of constant longitude. |
Extracts a subset of the grid by selecting all faces that are within a specified latitude interval. |
|
Extracts a subset of the grid by selecting all faces that are within a specified longitude interval. |
UxDataArray#
Accessor for performing unstructured grid subsetting with a data variable, accessed through |
|
|
Subsets an unstructured grid by returning the |
|
Subsets an unstructured grid between two latitude and longitude points which form a bounding box. |
|
Subsets an unstructured grid by returning all elements within some radius (in degrees) from a center coord. |
|
Extracts a subset of the data array across a line of constant-latitude. |
|
Extracts a subset of the data array across a line of constant-longitude. |
Extracts a subset of data by selecting all faces that are within a specified latitude interval. |
|
Extracts a subset of data by selecting all faces that are within a specified longitude interval. |
Cross Sections#
See also
Extracts a cross-section sampled along an arbitrary great-circle arc (GCA) or line of constant latitude/longitude. |
Remapping#
See also
UxDataArray#
Expose remapping methods on UxDataArray and UxDataset objects. |
|
|
Perform nearest-neighbor remapping. |
Perform inverse-distance-weighted (IDW) remapping. |
|
|
Perform bilinear remapping. |
UxDataset#
Expose remapping methods on UxDataArray and UxDataset objects. |
|
|
Perform nearest-neighbor remapping. |
Perform inverse-distance-weighted (IDW) remapping. |
|
|
Perform bilinear remapping. |
Mathematical Operators#
|
Computes the integral of a data variable. |
|
Computes the horizontal gradient of a data variable. |
|
Computes the absolute difference of a data variable. |
Dual Mesh Construction#
|
Compute the dual for a grid, which constructs a new grid centered around the nodes, where the nodes of the primal become the face centers of the dual, and the face centers of the primal become the nodes of the dual. |
Compute the dual mesh for a data array, returns a new data array object. |
|
Compute the dual mesh for a dataset, returns a new dataset object. |
Aggregations#
Topological#
Topological aggregations apply an aggregation (i.e. averaging) on a per-element basis. For example, instead of computing the average across all values, we can compute the average of all the nodes that surround each face and store the result on each face.
|
Performs a topological mean aggregation. |
|
Performs a topological min aggregation. |
|
Performs a topological max aggregation. |
|
Performs a topological median aggregation. |
|
Performs a topological std aggregation. |
|
Performs a topological var aggregation. |
|
Performs a topological sum aggregation. |
|
Performs a topological prod aggregation. |
|
Performs a topological all aggregation. |
|
Performs a topological any aggregation. |
Zonal Average#
|
Compute averages along lines of constant latitude. |
Weighted#
|
Computes a weighted mean. |
Spherical Geometry#
Intersections#
Calculate the intersection point(s) of a Great Circle Arc (GCA) and a constant latitude line in a Cartesian coordinate system. |
Arcs#
|
Determines whether the number q is between p and r. |
|
Check if a point lies on a given Great Circle Arc (GCA) interval, considering the smaller arc of the circle. |
|
Calculate the maximum or minimum latitude of a great circle arc defined by two 3D points. |
Accurate Computing#
|
Calculate the cross product of two 3D vectors utilizing the fused multiply-add operation. |
|
Calculate the dot product of two vectors using the FMA (fused multiply- add) operation. |