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 |
|
Open a multi-grid SCRIP file and construct |
|
Wraps |
|
Tutorial#
Return the names of available tutorial datasets. |
|
Return a short description for a tutorial dataset. |
|
|
Return the local path for a tutorial dataset file. |
|
Return the local paths for a multi-file tutorial dataset. |
|
Open the grid file for a tutorial dataset. |
|
Open a tutorial dataset with its associated grid. |
|
Open a multi-file tutorial dataset with its associated grid. |
Grid#
Constructors#
|
Represents a two-dimensional unstructured grid encoded following the UGRID conventions and provides grid-specific functionality. |
|
Constructs a |
|
Constructs a |
|
Constructs a |
|
Constructs a |
|
Create a grid from unstructured points. |
|
Converts a structured |
|
Constructs a |
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. |
Indexing#
|
Identifies the indices of edges that intersect with a line of constant latitude. |
|
Identifies the indices of edges that intersect with a line of constant longitude. |
Identifies the indices of faces that intersect with a line of constant latitude. |
|
Identifies the indices of faces that intersect with a line of constant longitude. |
|
Identifies the indices of faces that are strictly between two lines of constant latitude. |
|
Identifies the indices of faces that are strictly between two lines of constant longitude. |
|
|
Identify which grid faces contain the given point(s). |
|
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#
Names of all coordinate variables. |
|
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#
Names of all coordinate variables. |
|
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. |
|
Indices of faces that touch or cross the antimeridian. |
|
Spherical bounds of each face in degrees |
|
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. |
|
Arc distance between the two nodes that make up each edge (in radians). |
|
Arc distance between the faces that saddle each edge (in radians). |
|
Area of each face. |
|
Longitude bounds for each face in degrees. |
|
Latitude bounds for each face in degrees. |
|
Returns True if the Grid is a subset, 'False' otherwise. |
|
Boolean indicated whether the Grid completely covers the unit sphere (i.e. contains no holes). |
|
Maximum Euclidean distance from each face center to its nodes. |
|
Boolean indicated whether the Grid partial covers the unit sphere (i.e. contains holes). |
|
Physical sphere radius from the source grid (e.g., Earth's radius for MPAS ocean grids). |
|
Boolean indicated whether the Grid is strictly composed of triangular faces. |
Attributes#
Dictionary of parsed attributes from the source grid. |
Methods#
|
Converts all arrays to dask arrays with given chunks across grid dimensions in-place. |
Returns a deep copy of this grid. |
|
Function to calculate the total surface area of all the faces in a mesh. |
|
|
Face areas calculation function for grid class, calculates area of all faces in the grid. |
|
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 BallTree data structure of this Grid that allows for nearest neighbor queries (k nearest or within some radius) on either the ( |
|
Get the KDTree data structure of this Grid that allows for nearest neighbor queries (k nearest or within some radius) on either the ( |
|
Get the SpatialHash data structure of this Grid that allows for fast face search queries. |
|
Identify which grid faces contain the given point(s). |
Normalizes Cartesian coordinates. |
|
|
Validates the current |
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 |
Dual Mesh Construction#
Compute the dual mesh for a data array, returns a new data array object. |
Selection & Indexing#
|
Return a new DataArray whose data is given by selecting indexes along the specified dimension(s). |
|
Filter elements from this object according to a condition. |
Grid Accessor#
Linked |
UxDataset#
Constructors#
|
Grid informed |
|
Override to make the result a |
|
Override to make the result a |
|
Loads a dataset represented in the HEALPix format into a |
Converts a structured |
|
|
Converts a |
Dual Mesh Construction#
Compute the dual mesh for a dataset, returns a new dataset object. |
Grid Accessor#
Linked |
Attributes#
Property to keep track of the source data sets used to instantiate this |
Methods#
|
Concise summary of Dataset variables and attributes including grid topology information stored in the |
Selection & Indexing#
|
Returns a new dataset with each array indexed along the specified dimension(s). |
|
Returns a new dataset with each array indexed by tick labels along the specified dimension(s). |
|
Filter elements from this object according to a condition. |
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#
|
Convert a |
|
Constructs a |
Constructs a |
|
|
Rasterizes a data variable stored on the faces of an unstructured grid onto the pixels of the provided Cartopy GeoAxes. |
UxDataset#
Override to make the result an instance of |
|
|
Converts a |
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 curl of a vector field. |
|
Computes the absolute difference of a data variable. |
|
Computes the divergence of the vector field defined by this UxDataArray and other. |
|
Computes the gradient of a data variable. |
|
Computes the integral of a data variable. |
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. |
Azimuthal#
Azimuthal aggregations apply an aggregation (i.e. averaging) along circles of constant great-circle distance from a specified point on the sphere.
|
Compute averages along circles of constant great-circle distance from a point. |
Zonal Average#
|
Alias of zonal_mean; prefer zonal_mean for primary API. |
|
Compute non-conservative or conservative averages of a face-centered variable along lines of constant latitude or latitude bands. |
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. |