Internal API#

This page shows already-implemented Uxarray internal API functions. You can also check the draft Uxarray API documentation to see the tentative whole API and let us know if you have any feedback!

Grid Methods#

grid.Grid.__init_ds_var_names__

Populates a dictionary for storing uxarray's internal representation of xarray object.

grid.Grid.__from_ds__

Loads a mesh dataset.

grid.Grid.__from_vert__

Create a grid with faces constructed from vertices specified by the given argument.

grid.Grid.__init_grid_var_attrs__

Initialize attributes for directly accessing UGRID dimensions and variables.

grid.Grid._build_edge_node_connectivity

Constructs the UGRID connectivity variable (Mesh2_edge_nodes) and stores it within the internal (Grid.ds) and through the attribute (Grid.Mesh2_edge_nodes).

grid.Grid._build_face_edges_connectivity

Constructs the UGRID connectivity variable (Mesh2_face_edges) and stores it within the internal (Grid.ds) and through the attribute (Grid.Mesh2_face_edges).

grid.Grid._populate_cartesian_xyz_coord

A helper function that populates the xyz attribute in UXarray.ds.

grid.Grid._populate_lonlat_coord

Helper function that populates the longitude and latitude and store it into the Mesh2_node_x and Mesh2_node_y.

grid.Grid._build_nNodes_per_face

Constructs nNodes_per_face, which contains the number of non- fill-value nodes for each face in Mesh2_face_nodes

Grid Helper Modules#

_exodus._read_exodus

Exodus file reader.

_exodus._encode_exodus

Encodes an Exodus file.

_exodus._get_element_type

Helper function to get exodus element type from number of nodes.

_ugrid._encode_ugrid

Encodes UGRID file .

_ugrid._read_ugrid

UGRID file reader.

_mpas._dual_to_ugrid

Encodes the MPAS Dual-Mesh in the UGRID conventions.

_mpas._primal_to_ugrid

Encodes the MPAS Primal-Mesh in the UGRID conventions.

_mpas._replace_padding

Replaces the padded values in verticesOnCell defined by nEdgesOnCell with a fill-value.

_mpas._replace_zeros

Replaces all instances of a zero (invalid/missing MPAS value) with a fill value.

_mpas._to_zero_index

Given an input using that is one-indexed, subtracts one from all non- fill value entries to convert to zero-indexed.

_mpas._set_global_attrs

Helper to set MPAS global attributes.

_mpas._read_mpas

Function to read in a MPAS Grid dataset and encode either the Primal or Dual Mesh in the UGRID conventions.

_scrip._read_scrip

Function to reassign lat/lon variables to mesh2_node variables.

_scrip._encode_scrip

Function to reassign UGRID formatted variables to SCRIP formatted variables.

_scrip._to_ugrid

If input dataset (in_ds) file is an unstructured SCRIP file, function will reassign SCRIP variables to UGRID conventions in output file (out_ds).

helpers._is_ugrid

Check mesh topology and dimension.

helpers._replace_fill_values

Replaces all instances of the the current fill value (original_fill) in (grid_var) with (new_fill) and converts to the dtype defined by (new_dtype)