Data Structures
UXarray extends upon Xarray’s core data structures (i.e. Dataset and DataArray) and provides functionality for operating on unstructured (a.k.a. non-regular) grids.
This notebook will showcase the core UXarray data structures and how to interact with them
import uxarray as ux
First, lets specify the paths to our Grid and Data files. As mentioned in the previous notebook, unstructured grids are typically separated into two files: one containing the grid topology and one containing data variables that reside on that grid.
file_dir = "../../meshfiles/"
grid_filename = file_dir + "oQU480.grid.nc"
data_filename = file_dir + "oQU480.data.nc"
Grid
Data Structure
An unstructured grid file can be opened standalone using the ux.open_grid
method, which is a catch-all method that parses the provided input and returns a Grid
object with grid coordinate and connectivity variables represented in the UGRID conventions.
Printing our Grid
instance shows all available grid variables and original grid type.
grid = ux.open_grid(grid_filename)
grid
<uxarray.Grid> Original Grid Type: MPAS Grid Dimensions: * n_node: 3947 * n_edge: 5754 * n_face: 1791 * n_max_face_nodes: 6 * n_max_face_edges: 6 * n_max_face_faces: 6 * n_max_node_faces: 3 * two: 2 * n_nodes_per_face: (1791,) Grid Coordinates (Spherical): * node_lon: (3947,) * node_lat: (3947,) * edge_lon: (5754,) * edge_lat: (5754,) * face_lon: (1791,) * face_lat: (1791,) Grid Coordinates (Cartesian): * node_x: (3947,) * node_y: (3947,) * node_z: (3947,) * edge_x: (5754,) * edge_y: (5754,) * edge_z: (5754,) * face_x: (1791,) * face_y: (1791,) * face_z: (1791,) Grid Connectivity Variables: * face_node_connectivity: (1791, 6) * face_edge_connectivity: (1791, 6) * face_face_connectivity: (1791, 6) * edge_node_connectivity: (5754, 2) * edge_face_connectivity: (5754, 2) * node_face_connectivity: (3947, 3) Grid Descriptor Variables: * face_areas: (1791,) * n_nodes_per_face: (1791,) * edge_face_distances: (5754,) * edge_node_distances: (5754,)
- n_node: 3947
- n_face: 1791
- n_edge: 5754
- n_max_face_nodes: 6
- n_max_node_faces: 3
- two: 2
- n_max_face_edges: 6
- n_max_face_faces: 6
- node_lon(n_node)float64-175.0 -172.5 ... -103.0 -175.0
- standard_name :
- longitude
- long name :
- Longitude of the corner nodes of each face
- units :
- degrees_east
array([-174.95294523, -172.5318284 , -173.42204784, ..., 113.04705503, -102.95294492, -174.9529447 ])
- node_lat(n_node)float6424.27 25.84 28.41 ... -52.62 -52.62
- standard_name :
- latitude
- long name :
- Latitude of the corner nodes of each face
- units :
- degrees_north
array([ 24.27387793, 25.83662184, 28.41042985, ..., -10.81231712, -52.62263157, -52.62263191])
- edge_lon(n_edge)float64-176.8 -173.1 ... -120.8 -113.0
- standard_name :
- longitude
- long name :
- Longitude of the center of each edge
- units :
- degrees_east
array([-176.77621884, -173.12967054, -102.95294493, ..., -161.10860309, -120.7574067 , -113.02625979])
- edge_lat(n_edge)float64-53.24 -53.24 ... -11.07 -6.11
- standard_name :
- latitude
- long name :
- Latitude of the center of each edge
- units :
- degrees_north
array([-53.23874449, -53.23874448, -51.3627372 , ..., -50.6652819 , -11.06951516, -6.11034278])
- face_lon(n_face)float64-175.0 116.8 ... -175.0 -178.4
- standard_name :
- longitude
- long name :
- Longitude of the center of each face
- units :
- degrees_east
array([-174.95294524, 116.76453044, 5.04705476, ..., -171.46260489, -174.95294467, -178.44328452])
- face_lat(n_face)float6426.57 90.0 -26.57 ... -55.14 -51.31
- standard_name :
- latitude
- long name :
- Latitude of the center of each face
- units :
- degrees_north
array([ 26.56505115, 90. , -26.56505115, ..., -51.3108445 , -55.1412034 , -51.31084451])
- node_x(n_node)float64-5.785e+06 ... -3.853e+06
- standard_name :
- x
- long name :
- Cartesian x location of the corner nodes of each face
- units :
- meters
array([-5785435.04002924, -5685720.13738219, -5566999.92358776, ..., -2449972.55838108, -866954.85647526, -3852734.97402842])
- node_y(n_node)float64-5.109e+05 ... -3.403e+05
- standard_name :
- y
- long name :
- Cartesian y location of the corner nodes of each face
- units :
- meters
array([ -510948.0428268 , -745326.27060765, -641953.06270647, ..., 5758619.90701722, -3769314.609438 , -340259.21827198])
- node_z(n_node)float642.619e+06 2.777e+06 ... -5.063e+06
- standard_name :
- z
- long name :
- Cartesian z location of the corner nodes of each face
- units :
- meters
array([ 2619204.54825016, 2776622.81200557, 3031330.91009488, ..., -1195194.62855456, -5062925.5991326 , -5062925.6220806 ])
- edge_x(n_edge)float64-3.807e+06 ... -2.478e+06
- standard_name :
- x
- long name :
- Cartesian x location of the center of each edge
- units :
- meters
array([-3807031.68053685, -3785685.80531731, -891698.00758265, ..., -3820868.75526419, -3197652.82546307, -2477966.7682748 ])
- edge_y(n_edge)float64-2.144e+05 -4.561e+05 ... -5.83e+06
- standard_name :
- y
- long name :
- Cartesian y location of the center of each edge
- units :
- meters
array([ -214431.23620054, -456129.3234269 , -3876891.97452953, ..., -1307534.83897474, -5373190.29110637, -5830293.00724777])
- edge_z(n_edge)float64-5.104e+06 ... -6.782e+05
- standard_name :
- z
- long name :
- Cartesian z location of the center of each edge
- units :
- meters
array([-5104222.56555993, -5104222.56510922, -4976659.74841988, ..., -4927867.040653 , -1223274.89707315, -678176.31586817])
- face_x(n_face)float64-5.677e+06 ... -3.981e+06
- standard_name :
- x
- long name :
- Cartesian x location of the center of each face
- units :
- meters
array([-5.67650576e+06, -1.75683115e-10, 5.67650576e+06, ..., -3.93849224e+06, -3.62739475e+06, -3.98115306e+06])
- face_y(n_face)float64-5.013e+05 3.483e-10 ... -1.082e+05
- standard_name :
- y
- long name :
- Cartesian y location of the center of each face
- units :
- meters
array([-5.01327814e+05, 3.48329100e-10, 5.01327814e+05, ..., -5.91239806e+05, -3.20358010e+05, -1.08193799e+05])
- face_z(n_face)float642.849e+06 6.371e+06 ... -4.973e+06
- standard_name :
- z
- long name :
- Cartesian z location of the center of each face
- units :
- meters
array([ 2849300.2259504 , 6371229. , -2849300.22595038, ..., -4973054.73241341, -5227995.5072016 , -4973054.73329557])
- face_face_connectivity(n_face, n_max_face_faces)int64445 446 447 448 ... 1100 1105 442
- cf_role :
- face_face_connectivity
- long name :
- Faces that neighbor each face.
- start_index :
- 0
- _FillValue :
- -9223372036854775808
array([[ 445, 446, 447, 448, 444, -9223372036854775808], [ 451, 452, 453, 449, 450, -9223372036854775808], [ 454, 455, 456, 457, 458, -9223372036854775808], ..., [ 1789, 441, 1106, 1111, 443, 1790], [ 1790, 442, 1098, 1097, 441, 1788], [ 1789, 1788, 443, 1100, 1105, 442]])
- edge_face_connectivity(n_edge, two)int641789 1790 1788 ... 1318 1319 1320
- cf_role :
- edge_face_connectivity
- long name :
- Faces that neighbor each edge
- start_index :
- 0
- _FillValue :
- -9223372036854775808
array([[1789, 1790], [1788, 1789], [1786, 1787], ..., [1106, 1107], [1315, 1318], [1319, 1320]])
- face_node_connectivity(n_face, n_max_face_nodes)int642 3 4 0 1 ... 2959 3689 2951 2950
- cf_role :
- face_node_connectivity
- long name :
- Maps every face to its corner nodes.
- start_index :
- 0
- _FillValue :
- -9223372036854775808
array([[ 2, 3, 4, 0, 1, -9223372036854775808], [ 6, 7, 8, 9, 5, -9223372036854775808], [ 14, 10, 11, 12, 13, -9223372036854775808], ..., [ 2943, 2948, 3695, 2955, 2960, 3946], [ 2950, 2949, 3686, 2944, 2943, 3946], [ 3946, 2960, 2959, 3689, 2951, 2950]])
- face_edge_connectivity(n_face, n_max_face_edges)int641798 2207 2233 ... 2972 767 3766
- cf_role :
- face_edge_connectivity
- long name :
- Maps every face to its edges.
- start_index :
- 0
- _FillValue :
- -9223372036854775808
array([[ 1798, 2207, 2233, 2756, 2023, -9223372036854775808], [ 518, 2743, 1647, 2192, 2883, -9223372036854775808], [ 2136, 3140, 2297, 2910, 2148, -9223372036854775808], ..., [ 1, 3764, 5572, 5580, 3774, 864], [ 0, 451, 5552, 5549, 3787, 1], [ 0, 864, 3520, 2972, 767, 3766]])
- edge_node_connectivity(n_edge, two)int643946 2950 3946 ... 3773 3774 1183
- cf_role :
- edge_node_connectivity
- long name :
- Maps every edge to the two nodes that it connects.
- start_index :
- 0
array([[3946, 2950], [3946, 2943], [3945, 2931], ..., [3694, 733], [2520, 3773], [3774, 1183]])
- node_face_connectivity(n_node, n_max_node_faces)int640 448 444 445 ... 1789 1788 1790
- cf_role :
- node_face_connectivity
- long name :
- Faces that neighbor each node
- start_index :
- 0
- _FillValue :
- -9223372036854775808
array([[ 0, 448, 444], [ 445, 0, 444], [ 445, 446, 0], ..., [ 1784, 1783, -9223372036854775808], [ 1786, 1785, 1787], [ 1789, 1788, 1790]])
- face_areas(n_face)float641.544e+11 1.544e+11 ... 2.056e+11
- cf_role :
- face_areas
- long_name :
- Area of each face.
array([1.54356679e+11, 1.54356671e+11, 1.54356679e+11, ..., 2.05569717e+11, 2.05569711e+11, 2.05569714e+11])
- n_nodes_per_face(n_face)int645 5 5 5 5 5 6 6 ... 6 6 6 6 6 6 6 6
- cf_role :
- n_nodes_per_face
- long name :
- Number of nodes per face
array([5, 5, 5, ..., 6, 6, 6])
- edge_face_distances(n_edge)float644.85e+05 4.85e+05 ... 4.973e+05
- cf_role :
- edge_face_distances
- long_name :
- Distances between the face centers that saddle each edge
array([485043.30496367, 485043.30497902, 485043.29817844, ..., 485257.26806516, 487744.75389715, 497267.02740464])
- edge_node_distances(n_edge)float642.853e+05 2.853e+05 ... 2.62e+05
- cf_role :
- edge_node_distances
- long_name :
- Distances between the nodes that make up each edge.
array([285298.40090449, 285298.42467823, 285298.39522781, ..., 283573.13698969, 274517.22789552, 261978.54516178])
- on_a_sphere :
- YES
- sphere_radius :
- 6371229.0
- is_periodic :
- NO
- parent_id :
- kufh9o2jwx lsd2k42w1r a4x6sqhkwb
- history :
- Tue Oct 10 16:52:25 2023: ./convert.py MpasMeshConverter.x ocean.QU.480km.151209.nc ocean.QU.480km.20231010.nc mpirun -n 2 ./ocean_model
- mesh_spec :
- 1.0
- Conventions :
- MPAS
- source :
- MpasMeshConverter.x
- file_id :
- 85scxk6tmk
We can access our coordinate, connectivity, and other descriptor variables as attributes through this Grid
instance
grid.node_lon
<xarray.DataArray 'node_lon' (n_node: 3947)> Size: 32kB array([-174.95294523, -172.5318284 , -173.42204784, ..., 113.04705503, -102.95294492, -174.9529447 ]) Dimensions without coordinates: n_node Attributes: standard_name: longitude long name: Longitude of the corner nodes of each face units: degrees_east
- n_node: 3947
- -175.0 -172.5 -173.4 -176.5 -177.4 ... 77.05 113.0 113.0 -103.0 -175.0
array([-174.95294523, -172.5318284 , -173.42204784, ..., 113.04705503, -102.95294492, -174.9529447 ])
- standard_name :
- longitude
- long name :
- Longitude of the corner nodes of each face
- units :
- degrees_east
grid.face_node_connectivity
<xarray.DataArray 'face_node_connectivity' (n_face: 1791, n_max_face_nodes: 6)> Size: 86kB array([[ 2, 3, 4, 0, 1, -9223372036854775808], [ 6, 7, 8, 9, 5, -9223372036854775808], [ 14, 10, 11, 12, 13, -9223372036854775808], ..., [ 2943, 2948, 3695, 2955, 2960, 3946], [ 2950, 2949, 3686, 2944, 2943, 3946], [ 3946, 2960, 2959, 3689, 2951, 2950]]) Dimensions without coordinates: n_face, n_max_face_nodes Attributes: cf_role: face_node_connectivity long name: Maps every face to its corner nodes. start_index: 0 _FillValue: -9223372036854775808
- n_face: 1791
- n_max_face_nodes: 6
- 2 3 4 0 1 -9223372036854775808 6 ... 3946 2960 2959 3689 2951 2950
array([[ 2, 3, 4, 0, 1, -9223372036854775808], [ 6, 7, 8, 9, 5, -9223372036854775808], [ 14, 10, 11, 12, 13, -9223372036854775808], ..., [ 2943, 2948, 3695, 2955, 2960, 3946], [ 2950, 2949, 3686, 2944, 2943, 3946], [ 3946, 2960, 2959, 3689, 2951, 2950]])
- cf_role :
- face_node_connectivity
- long name :
- Maps every face to its corner nodes.
- start_index :
- 0
- _FillValue :
- -9223372036854775808
UxDataset
& UxDataArray
Data Structures
UXarray inherits from Xarray’s two core data structures Dataset
& DataArray
to provide a grid-informed implementation through the UxDataset
& UxDataArray
data structures.
The major difference between them is that UXarray’s implementation is paired with a Grid
object, accessed through the .uxgrid
property.
UXarray also provides an overloaded ux.open_dataset
method, which takes in both a Grid and Data file path to construct a UxDataset
uxds = ux.open_dataset(grid_filename, data_filename)
uxds
<xarray.UxDataset> Size: 14kB Dimensions: (n_face: 1791) Dimensions without coordinates: n_face Data variables: bottomDepth (n_face) float64 14kB ...
<xarray.UxDataset> Size: 14kB Dimensions: (n_face: 1791) Dimensions without coordinates: n_face Data variables: bottomDepth (n_face) float64 14kB ...
- n_face: 1791
- bottomDepth(n_face)float64...
[1791 values with dtype=float64]
Show Grid Information
<uxarray.Grid> Original Grid Type: MPAS Grid Dimensions: * n_node: 3947 * n_edge: 5754 * n_face: 1791 * n_max_face_nodes: 6 * n_max_face_edges: 6 * n_max_face_faces: 6 * n_max_node_faces: 3 * two: 2 * n_nodes_per_face: (1791,) Grid Coordinates (Spherical): * node_lon: (3947,) * node_lat: (3947,) * edge_lon: (5754,) * edge_lat: (5754,) * face_lon: (1791,) * face_lat: (1791,) Grid Coordinates (Cartesian): * node_x: (3947,) * node_y: (3947,) * node_z: (3947,) * edge_x: (5754,) * edge_y: (5754,) * edge_z: (5754,) * face_x: (1791,) * face_y: (1791,) * face_z: (1791,) Grid Connectivity Variables: * face_node_connectivity: (1791, 6) * face_edge_connectivity: (1791, 6) * face_face_connectivity: (1791, 6) * edge_node_connectivity: (5754, 2) * edge_face_connectivity: (5754, 2) * node_face_connectivity: (3947, 3) Grid Descriptor Variables: * face_areas: (1791,) * n_nodes_per_face: (1791,) * edge_face_distances: (5754,) * edge_node_distances: (5754,)
- n_node: 3947
- n_face: 1791
- n_edge: 5754
- n_max_face_nodes: 6
- n_max_node_faces: 3
- two: 2
- n_max_face_edges: 6
- n_max_face_faces: 6
- node_lon(n_node)float64-175.0 -172.5 ... -103.0 -175.0
- standard_name :
- longitude
- long name :
- Longitude of the corner nodes of each face
- units :
- degrees_east
array([-174.95294523, -172.5318284 , -173.42204784, ..., 113.04705503, -102.95294492, -174.9529447 ])
- node_lat(n_node)float6424.27 25.84 28.41 ... -52.62 -52.62
- standard_name :
- latitude
- long name :
- Latitude of the corner nodes of each face
- units :
- degrees_north
array([ 24.27387793, 25.83662184, 28.41042985, ..., -10.81231712, -52.62263157, -52.62263191])
- edge_lon(n_edge)float64-176.8 -173.1 ... -120.8 -113.0
- standard_name :
- longitude
- long name :
- Longitude of the center of each edge
- units :
- degrees_east
array([-176.77621884, -173.12967054, -102.95294493, ..., -161.10860309, -120.7574067 , -113.02625979])
- edge_lat(n_edge)float64-53.24 -53.24 ... -11.07 -6.11
- standard_name :
- latitude
- long name :
- Latitude of the center of each edge
- units :
- degrees_north
array([-53.23874449, -53.23874448, -51.3627372 , ..., -50.6652819 , -11.06951516, -6.11034278])
- face_lon(n_face)float64-175.0 116.8 ... -175.0 -178.4
- standard_name :
- longitude
- long name :
- Longitude of the center of each face
- units :
- degrees_east
array([-174.95294524, 116.76453044, 5.04705476, ..., -171.46260489, -174.95294467, -178.44328452])
- face_lat(n_face)float6426.57 90.0 -26.57 ... -55.14 -51.31
- standard_name :
- latitude
- long name :
- Latitude of the center of each face
- units :
- degrees_north
array([ 26.56505115, 90. , -26.56505115, ..., -51.3108445 , -55.1412034 , -51.31084451])
- node_x(n_node)float64-5.785e+06 ... -3.853e+06
- standard_name :
- x
- long name :
- Cartesian x location of the corner nodes of each face
- units :
- meters
array([-5785435.04002924, -5685720.13738219, -5566999.92358776, ..., -2449972.55838108, -866954.85647526, -3852734.97402842])
- node_y(n_node)float64-5.109e+05 ... -3.403e+05
- standard_name :
- y
- long name :
- Cartesian y location of the corner nodes of each face
- units :
- meters
array([ -510948.0428268 , -745326.27060765, -641953.06270647, ..., 5758619.90701722, -3769314.609438 , -340259.21827198])
- node_z(n_node)float642.619e+06 2.777e+06 ... -5.063e+06
- standard_name :
- z
- long name :
- Cartesian z location of the corner nodes of each face
- units :
- meters
array([ 2619204.54825016, 2776622.81200557, 3031330.91009488, ..., -1195194.62855456, -5062925.5991326 , -5062925.6220806 ])
- edge_x(n_edge)float64-3.807e+06 ... -2.478e+06
- standard_name :
- x
- long name :
- Cartesian x location of the center of each edge
- units :
- meters
array([-3807031.68053685, -3785685.80531731, -891698.00758265, ..., -3820868.75526419, -3197652.82546307, -2477966.7682748 ])
- edge_y(n_edge)float64-2.144e+05 -4.561e+05 ... -5.83e+06
- standard_name :
- y
- long name :
- Cartesian y location of the center of each edge
- units :
- meters
array([ -214431.23620054, -456129.3234269 , -3876891.97452953, ..., -1307534.83897474, -5373190.29110637, -5830293.00724777])
- edge_z(n_edge)float64-5.104e+06 ... -6.782e+05
- standard_name :
- z
- long name :
- Cartesian z location of the center of each edge
- units :
- meters
array([-5104222.56555993, -5104222.56510922, -4976659.74841988, ..., -4927867.040653 , -1223274.89707315, -678176.31586817])
- face_x(n_face)float64-5.677e+06 ... -3.981e+06
- standard_name :
- x
- long name :
- Cartesian x location of the center of each face
- units :
- meters
array([-5.67650576e+06, -1.75683115e-10, 5.67650576e+06, ..., -3.93849224e+06, -3.62739475e+06, -3.98115306e+06])
- face_y(n_face)float64-5.013e+05 3.483e-10 ... -1.082e+05
- standard_name :
- y
- long name :
- Cartesian y location of the center of each face
- units :
- meters
array([-5.01327814e+05, 3.48329100e-10, 5.01327814e+05, ..., -5.91239806e+05, -3.20358010e+05, -1.08193799e+05])
- face_z(n_face)float642.849e+06 6.371e+06 ... -4.973e+06
- standard_name :
- z
- long name :
- Cartesian z location of the center of each face
- units :
- meters
array([ 2849300.2259504 , 6371229. , -2849300.22595038, ..., -4973054.73241341, -5227995.5072016 , -4973054.73329557])
- face_face_connectivity(n_face, n_max_face_faces)int64445 446 447 448 ... 1100 1105 442
- cf_role :
- face_face_connectivity
- long name :
- Faces that neighbor each face.
- start_index :
- 0
- _FillValue :
- -9223372036854775808
array([[ 445, 446, 447, 448, 444, -9223372036854775808], [ 451, 452, 453, 449, 450, -9223372036854775808], [ 454, 455, 456, 457, 458, -9223372036854775808], ..., [ 1789, 441, 1106, 1111, 443, 1790], [ 1790, 442, 1098, 1097, 441, 1788], [ 1789, 1788, 443, 1100, 1105, 442]])
- edge_face_connectivity(n_edge, two)int641789 1790 1788 ... 1318 1319 1320
- cf_role :
- edge_face_connectivity
- long name :
- Faces that neighbor each edge
- start_index :
- 0
- _FillValue :
- -9223372036854775808
array([[1789, 1790], [1788, 1789], [1786, 1787], ..., [1106, 1107], [1315, 1318], [1319, 1320]])
- face_node_connectivity(n_face, n_max_face_nodes)int642 3 4 0 1 ... 2959 3689 2951 2950
- cf_role :
- face_node_connectivity
- long name :
- Maps every face to its corner nodes.
- start_index :
- 0
- _FillValue :
- -9223372036854775808
array([[ 2, 3, 4, 0, 1, -9223372036854775808], [ 6, 7, 8, 9, 5, -9223372036854775808], [ 14, 10, 11, 12, 13, -9223372036854775808], ..., [ 2943, 2948, 3695, 2955, 2960, 3946], [ 2950, 2949, 3686, 2944, 2943, 3946], [ 3946, 2960, 2959, 3689, 2951, 2950]])
- face_edge_connectivity(n_face, n_max_face_edges)int641798 2207 2233 ... 2972 767 3766
- cf_role :
- face_edge_connectivity
- long name :
- Maps every face to its edges.
- start_index :
- 0
- _FillValue :
- -9223372036854775808
array([[ 1798, 2207, 2233, 2756, 2023, -9223372036854775808], [ 518, 2743, 1647, 2192, 2883, -9223372036854775808], [ 2136, 3140, 2297, 2910, 2148, -9223372036854775808], ..., [ 1, 3764, 5572, 5580, 3774, 864], [ 0, 451, 5552, 5549, 3787, 1], [ 0, 864, 3520, 2972, 767, 3766]])
- edge_node_connectivity(n_edge, two)int643946 2950 3946 ... 3773 3774 1183
- cf_role :
- edge_node_connectivity
- long name :
- Maps every edge to the two nodes that it connects.
- start_index :
- 0
array([[3946, 2950], [3946, 2943], [3945, 2931], ..., [3694, 733], [2520, 3773], [3774, 1183]])
- node_face_connectivity(n_node, n_max_node_faces)int640 448 444 445 ... 1789 1788 1790
- cf_role :
- node_face_connectivity
- long name :
- Faces that neighbor each node
- start_index :
- 0
- _FillValue :
- -9223372036854775808
array([[ 0, 448, 444], [ 445, 0, 444], [ 445, 446, 0], ..., [ 1784, 1783, -9223372036854775808], [ 1786, 1785, 1787], [ 1789, 1788, 1790]])
- face_areas(n_face)float641.544e+11 1.544e+11 ... 2.056e+11
- cf_role :
- face_areas
- long_name :
- Area of each face.
array([1.54356679e+11, 1.54356671e+11, 1.54356679e+11, ..., 2.05569717e+11, 2.05569711e+11, 2.05569714e+11])
- edge_face_distances(n_edge)float644.85e+05 4.85e+05 ... 4.973e+05
- cf_role :
- edge_face_distances
- long_name :
- Distances between the face centers that saddle each edge
array([485043.30496367, 485043.30497902, 485043.29817844, ..., 485257.26806516, 487744.75389715, 497267.02740464])
- edge_node_distances(n_edge)float642.853e+05 2.853e+05 ... 2.62e+05
- cf_role :
- edge_node_distances
- long_name :
- Distances between the nodes that make up each edge.
array([285298.40090449, 285298.42467823, 285298.39522781, ..., 283573.13698969, 274517.22789552, 261978.54516178])
- on_a_sphere :
- YES
- sphere_radius :
- 6371229.0
- is_periodic :
- NO
- parent_id :
- kufh9o2jwx lsd2k42w1r a4x6sqhkwb
- history :
- Tue Oct 10 16:52:25 2023: ./convert.py MpasMeshConverter.x ocean.QU.480km.151209.nc ocean.QU.480km.20231010.nc mpirun -n 2 ./ocean_model
- mesh_spec :
- 1.0
- Conventions :
- MPAS
- source :
- MpasMeshConverter.x
- file_id :
- 85scxk6tmk
We can see that our UxDataset
has a single data variable bottomDepth
, which is mapped to each face (as specified by the n_face
dimension).
We can access this variable by indexing our UxDataset
to obtain a UxDataArray
uxds["bottomDepth"]
<xarray.UxDataArray 'bottomDepth' (n_face: 1791)> Size: 14kB [1791 values with dtype=float64] Dimensions without coordinates: n_face
<xarray.UxDataArray 'bottomDepth' (n_face: 1791)> Size: 14kB [1791 values with dtype=float64] Dimensions without coordinates: n_face
- n_face: 1791
- ...
[1791 values with dtype=float64]
Show Grid Information
<uxarray.Grid> Original Grid Type: MPAS Grid Dimensions: * n_node: 3947 * n_edge: 5754 * n_face: 1791 * n_max_face_nodes: 6 * n_max_face_edges: 6 * n_max_face_faces: 6 * n_max_node_faces: 3 * two: 2 * n_nodes_per_face: (1791,) Grid Coordinates (Spherical): * node_lon: (3947,) * node_lat: (3947,) * edge_lon: (5754,) * edge_lat: (5754,) * face_lon: (1791,) * face_lat: (1791,) Grid Coordinates (Cartesian): * node_x: (3947,) * node_y: (3947,) * node_z: (3947,) * edge_x: (5754,) * edge_y: (5754,) * edge_z: (5754,) * face_x: (1791,) * face_y: (1791,) * face_z: (1791,) Grid Connectivity Variables: * face_node_connectivity: (1791, 6) * face_edge_connectivity: (1791, 6) * face_face_connectivity: (1791, 6) * edge_node_connectivity: (5754, 2) * edge_face_connectivity: (5754, 2) * node_face_connectivity: (3947, 3) Grid Descriptor Variables: * face_areas: (1791,) * n_nodes_per_face: (1791,) * edge_face_distances: (5754,) * edge_node_distances: (5754,)
- n_node: 3947
- n_face: 1791
- n_edge: 5754
- n_max_face_nodes: 6
- n_max_node_faces: 3
- two: 2
- n_max_face_edges: 6
- n_max_face_faces: 6
- node_lon(n_node)float64-175.0 -172.5 ... -103.0 -175.0
- standard_name :
- longitude
- long name :
- Longitude of the corner nodes of each face
- units :
- degrees_east
array([-174.95294523, -172.5318284 , -173.42204784, ..., 113.04705503, -102.95294492, -174.9529447 ])
- node_lat(n_node)float6424.27 25.84 28.41 ... -52.62 -52.62
- standard_name :
- latitude
- long name :
- Latitude of the corner nodes of each face
- units :
- degrees_north
array([ 24.27387793, 25.83662184, 28.41042985, ..., -10.81231712, -52.62263157, -52.62263191])
- edge_lon(n_edge)float64-176.8 -173.1 ... -120.8 -113.0
- standard_name :
- longitude
- long name :
- Longitude of the center of each edge
- units :
- degrees_east
array([-176.77621884, -173.12967054, -102.95294493, ..., -161.10860309, -120.7574067 , -113.02625979])
- edge_lat(n_edge)float64-53.24 -53.24 ... -11.07 -6.11
- standard_name :
- latitude
- long name :
- Latitude of the center of each edge
- units :
- degrees_north
array([-53.23874449, -53.23874448, -51.3627372 , ..., -50.6652819 , -11.06951516, -6.11034278])
- face_lon(n_face)float64-175.0 116.8 ... -175.0 -178.4
- standard_name :
- longitude
- long name :
- Longitude of the center of each face
- units :
- degrees_east
array([-174.95294524, 116.76453044, 5.04705476, ..., -171.46260489, -174.95294467, -178.44328452])
- face_lat(n_face)float6426.57 90.0 -26.57 ... -55.14 -51.31
- standard_name :
- latitude
- long name :
- Latitude of the center of each face
- units :
- degrees_north
array([ 26.56505115, 90. , -26.56505115, ..., -51.3108445 , -55.1412034 , -51.31084451])
- node_x(n_node)float64-5.785e+06 ... -3.853e+06
- standard_name :
- x
- long name :
- Cartesian x location of the corner nodes of each face
- units :
- meters
array([-5785435.04002924, -5685720.13738219, -5566999.92358776, ..., -2449972.55838108, -866954.85647526, -3852734.97402842])
- node_y(n_node)float64-5.109e+05 ... -3.403e+05
- standard_name :
- y
- long name :
- Cartesian y location of the corner nodes of each face
- units :
- meters
array([ -510948.0428268 , -745326.27060765, -641953.06270647, ..., 5758619.90701722, -3769314.609438 , -340259.21827198])
- node_z(n_node)float642.619e+06 2.777e+06 ... -5.063e+06
- standard_name :
- z
- long name :
- Cartesian z location of the corner nodes of each face
- units :
- meters
array([ 2619204.54825016, 2776622.81200557, 3031330.91009488, ..., -1195194.62855456, -5062925.5991326 , -5062925.6220806 ])
- edge_x(n_edge)float64-3.807e+06 ... -2.478e+06
- standard_name :
- x
- long name :
- Cartesian x location of the center of each edge
- units :
- meters
array([-3807031.68053685, -3785685.80531731, -891698.00758265, ..., -3820868.75526419, -3197652.82546307, -2477966.7682748 ])
- edge_y(n_edge)float64-2.144e+05 -4.561e+05 ... -5.83e+06
- standard_name :
- y
- long name :
- Cartesian y location of the center of each edge
- units :
- meters
array([ -214431.23620054, -456129.3234269 , -3876891.97452953, ..., -1307534.83897474, -5373190.29110637, -5830293.00724777])
- edge_z(n_edge)float64-5.104e+06 ... -6.782e+05
- standard_name :
- z
- long name :
- Cartesian z location of the center of each edge
- units :
- meters
array([-5104222.56555993, -5104222.56510922, -4976659.74841988, ..., -4927867.040653 , -1223274.89707315, -678176.31586817])
- face_x(n_face)float64-5.677e+06 ... -3.981e+06
- standard_name :
- x
- long name :
- Cartesian x location of the center of each face
- units :
- meters
array([-5.67650576e+06, -1.75683115e-10, 5.67650576e+06, ..., -3.93849224e+06, -3.62739475e+06, -3.98115306e+06])
- face_y(n_face)float64-5.013e+05 3.483e-10 ... -1.082e+05
- standard_name :
- y
- long name :
- Cartesian y location of the center of each face
- units :
- meters
array([-5.01327814e+05, 3.48329100e-10, 5.01327814e+05, ..., -5.91239806e+05, -3.20358010e+05, -1.08193799e+05])
- face_z(n_face)float642.849e+06 6.371e+06 ... -4.973e+06
- standard_name :
- z
- long name :
- Cartesian z location of the center of each face
- units :
- meters
array([ 2849300.2259504 , 6371229. , -2849300.22595038, ..., -4973054.73241341, -5227995.5072016 , -4973054.73329557])
- face_face_connectivity(n_face, n_max_face_faces)int64445 446 447 448 ... 1100 1105 442
- cf_role :
- face_face_connectivity
- long name :
- Faces that neighbor each face.
- start_index :
- 0
- _FillValue :
- -9223372036854775808
array([[ 445, 446, 447, 448, 444, -9223372036854775808], [ 451, 452, 453, 449, 450, -9223372036854775808], [ 454, 455, 456, 457, 458, -9223372036854775808], ..., [ 1789, 441, 1106, 1111, 443, 1790], [ 1790, 442, 1098, 1097, 441, 1788], [ 1789, 1788, 443, 1100, 1105, 442]])
- edge_face_connectivity(n_edge, two)int641789 1790 1788 ... 1318 1319 1320
- cf_role :
- edge_face_connectivity
- long name :
- Faces that neighbor each edge
- start_index :
- 0
- _FillValue :
- -9223372036854775808
array([[1789, 1790], [1788, 1789], [1786, 1787], ..., [1106, 1107], [1315, 1318], [1319, 1320]])
- face_node_connectivity(n_face, n_max_face_nodes)int642 3 4 0 1 ... 2959 3689 2951 2950
- cf_role :
- face_node_connectivity
- long name :
- Maps every face to its corner nodes.
- start_index :
- 0
- _FillValue :
- -9223372036854775808
array([[ 2, 3, 4, 0, 1, -9223372036854775808], [ 6, 7, 8, 9, 5, -9223372036854775808], [ 14, 10, 11, 12, 13, -9223372036854775808], ..., [ 2943, 2948, 3695, 2955, 2960, 3946], [ 2950, 2949, 3686, 2944, 2943, 3946], [ 3946, 2960, 2959, 3689, 2951, 2950]])
- face_edge_connectivity(n_face, n_max_face_edges)int641798 2207 2233 ... 2972 767 3766
- cf_role :
- face_edge_connectivity
- long name :
- Maps every face to its edges.
- start_index :
- 0
- _FillValue :
- -9223372036854775808
array([[ 1798, 2207, 2233, 2756, 2023, -9223372036854775808], [ 518, 2743, 1647, 2192, 2883, -9223372036854775808], [ 2136, 3140, 2297, 2910, 2148, -9223372036854775808], ..., [ 1, 3764, 5572, 5580, 3774, 864], [ 0, 451, 5552, 5549, 3787, 1], [ 0, 864, 3520, 2972, 767, 3766]])
- edge_node_connectivity(n_edge, two)int643946 2950 3946 ... 3773 3774 1183
- cf_role :
- edge_node_connectivity
- long name :
- Maps every edge to the two nodes that it connects.
- start_index :
- 0
array([[3946, 2950], [3946, 2943], [3945, 2931], ..., [3694, 733], [2520, 3773], [3774, 1183]])
- node_face_connectivity(n_node, n_max_node_faces)int640 448 444 445 ... 1789 1788 1790
- cf_role :
- node_face_connectivity
- long name :
- Faces that neighbor each node
- start_index :
- 0
- _FillValue :
- -9223372036854775808
array([[ 0, 448, 444], [ 445, 0, 444], [ 445, 446, 0], ..., [ 1784, 1783, -9223372036854775808], [ 1786, 1785, 1787], [ 1789, 1788, 1790]])
- face_areas(n_face)float641.544e+11 1.544e+11 ... 2.056e+11
- cf_role :
- face_areas
- long_name :
- Area of each face.
array([1.54356679e+11, 1.54356671e+11, 1.54356679e+11, ..., 2.05569717e+11, 2.05569711e+11, 2.05569714e+11])
- n_nodes_per_face(n_face)int645 5 5 5 5 5 6 6 ... 6 6 6 6 6 6 6 6
- cf_role :
- n_nodes_per_face
- long name :
- Number of nodes per face
array([5, 5, 5, ..., 6, 6, 6])
- edge_face_distances(n_edge)float644.85e+05 4.85e+05 ... 4.973e+05
- cf_role :
- edge_face_distances
- long_name :
- Distances between the face centers that saddle each edge
array([485043.30496367, 485043.30497902, 485043.29817844, ..., 485257.26806516, 487744.75389715, 497267.02740464])
- edge_node_distances(n_edge)float642.853e+05 2.853e+05 ... 2.62e+05
- cf_role :
- edge_node_distances
- long_name :
- Distances between the nodes that make up each edge.
array([285298.40090449, 285298.42467823, 285298.39522781, ..., 283573.13698969, 274517.22789552, 261978.54516178])
- on_a_sphere :
- YES
- sphere_radius :
- 6371229.0
- is_periodic :
- NO
- parent_id :
- kufh9o2jwx lsd2k42w1r a4x6sqhkwb
- history :
- Tue Oct 10 16:52:25 2023: ./convert.py MpasMeshConverter.x ocean.QU.480km.151209.nc ocean.QU.480km.20231010.nc mpirun -n 2 ./ocean_model
- mesh_spec :
- 1.0
- Conventions :
- MPAS
- source :
- MpasMeshConverter.x
- file_id :
- 85scxk6tmk
You can access the Grid
instance using the .uxgrid
attribute, which is linked to every UxDataset
and UxDataArray
uxds.uxgrid
<uxarray.Grid> Original Grid Type: MPAS Grid Dimensions: * n_node: 3947 * n_edge: 5754 * n_face: 1791 * n_max_face_nodes: 6 * n_max_face_edges: 6 * n_max_face_faces: 6 * n_max_node_faces: 3 * two: 2 * n_nodes_per_face: (1791,) Grid Coordinates (Spherical): * node_lon: (3947,) * node_lat: (3947,) * edge_lon: (5754,) * edge_lat: (5754,) * face_lon: (1791,) * face_lat: (1791,) Grid Coordinates (Cartesian): * node_x: (3947,) * node_y: (3947,) * node_z: (3947,) * edge_x: (5754,) * edge_y: (5754,) * edge_z: (5754,) * face_x: (1791,) * face_y: (1791,) * face_z: (1791,) Grid Connectivity Variables: * face_node_connectivity: (1791, 6) * face_edge_connectivity: (1791, 6) * face_face_connectivity: (1791, 6) * edge_node_connectivity: (5754, 2) * edge_face_connectivity: (5754, 2) * node_face_connectivity: (3947, 3) Grid Descriptor Variables: * face_areas: (1791,) * n_nodes_per_face: (1791,) * edge_face_distances: (5754,) * edge_node_distances: (5754,)
- n_node: 3947
- n_face: 1791
- n_edge: 5754
- n_max_face_nodes: 6
- n_max_node_faces: 3
- two: 2
- n_max_face_edges: 6
- n_max_face_faces: 6
- node_lon(n_node)float64-175.0 -172.5 ... -103.0 -175.0
- standard_name :
- longitude
- long name :
- Longitude of the corner nodes of each face
- units :
- degrees_east
array([-174.95294523, -172.5318284 , -173.42204784, ..., 113.04705503, -102.95294492, -174.9529447 ])
- node_lat(n_node)float6424.27 25.84 28.41 ... -52.62 -52.62
- standard_name :
- latitude
- long name :
- Latitude of the corner nodes of each face
- units :
- degrees_north
array([ 24.27387793, 25.83662184, 28.41042985, ..., -10.81231712, -52.62263157, -52.62263191])
- edge_lon(n_edge)float64-176.8 -173.1 ... -120.8 -113.0
- standard_name :
- longitude
- long name :
- Longitude of the center of each edge
- units :
- degrees_east
array([-176.77621884, -173.12967054, -102.95294493, ..., -161.10860309, -120.7574067 , -113.02625979])
- edge_lat(n_edge)float64-53.24 -53.24 ... -11.07 -6.11
- standard_name :
- latitude
- long name :
- Latitude of the center of each edge
- units :
- degrees_north
array([-53.23874449, -53.23874448, -51.3627372 , ..., -50.6652819 , -11.06951516, -6.11034278])
- face_lon(n_face)float64-175.0 116.8 ... -175.0 -178.4
- standard_name :
- longitude
- long name :
- Longitude of the center of each face
- units :
- degrees_east
array([-174.95294524, 116.76453044, 5.04705476, ..., -171.46260489, -174.95294467, -178.44328452])
- face_lat(n_face)float6426.57 90.0 -26.57 ... -55.14 -51.31
- standard_name :
- latitude
- long name :
- Latitude of the center of each face
- units :
- degrees_north
array([ 26.56505115, 90. , -26.56505115, ..., -51.3108445 , -55.1412034 , -51.31084451])
- node_x(n_node)float64-5.785e+06 ... -3.853e+06
- standard_name :
- x
- long name :
- Cartesian x location of the corner nodes of each face
- units :
- meters
array([-5785435.04002924, -5685720.13738219, -5566999.92358776, ..., -2449972.55838108, -866954.85647526, -3852734.97402842])
- node_y(n_node)float64-5.109e+05 ... -3.403e+05
- standard_name :
- y
- long name :
- Cartesian y location of the corner nodes of each face
- units :
- meters
array([ -510948.0428268 , -745326.27060765, -641953.06270647, ..., 5758619.90701722, -3769314.609438 , -340259.21827198])
- node_z(n_node)float642.619e+06 2.777e+06 ... -5.063e+06
- standard_name :
- z
- long name :
- Cartesian z location of the corner nodes of each face
- units :
- meters
array([ 2619204.54825016, 2776622.81200557, 3031330.91009488, ..., -1195194.62855456, -5062925.5991326 , -5062925.6220806 ])
- edge_x(n_edge)float64-3.807e+06 ... -2.478e+06
- standard_name :
- x
- long name :
- Cartesian x location of the center of each edge
- units :
- meters
array([-3807031.68053685, -3785685.80531731, -891698.00758265, ..., -3820868.75526419, -3197652.82546307, -2477966.7682748 ])
- edge_y(n_edge)float64-2.144e+05 -4.561e+05 ... -5.83e+06
- standard_name :
- y
- long name :
- Cartesian y location of the center of each edge
- units :
- meters
array([ -214431.23620054, -456129.3234269 , -3876891.97452953, ..., -1307534.83897474, -5373190.29110637, -5830293.00724777])
- edge_z(n_edge)float64-5.104e+06 ... -6.782e+05
- standard_name :
- z
- long name :
- Cartesian z location of the center of each edge
- units :
- meters
array([-5104222.56555993, -5104222.56510922, -4976659.74841988, ..., -4927867.040653 , -1223274.89707315, -678176.31586817])
- face_x(n_face)float64-5.677e+06 ... -3.981e+06
- standard_name :
- x
- long name :
- Cartesian x location of the center of each face
- units :
- meters
array([-5.67650576e+06, -1.75683115e-10, 5.67650576e+06, ..., -3.93849224e+06, -3.62739475e+06, -3.98115306e+06])
- face_y(n_face)float64-5.013e+05 3.483e-10 ... -1.082e+05
- standard_name :
- y
- long name :
- Cartesian y location of the center of each face
- units :
- meters
array([-5.01327814e+05, 3.48329100e-10, 5.01327814e+05, ..., -5.91239806e+05, -3.20358010e+05, -1.08193799e+05])
- face_z(n_face)float642.849e+06 6.371e+06 ... -4.973e+06
- standard_name :
- z
- long name :
- Cartesian z location of the center of each face
- units :
- meters
array([ 2849300.2259504 , 6371229. , -2849300.22595038, ..., -4973054.73241341, -5227995.5072016 , -4973054.73329557])
- face_face_connectivity(n_face, n_max_face_faces)int64445 446 447 448 ... 1100 1105 442
- cf_role :
- face_face_connectivity
- long name :
- Faces that neighbor each face.
- start_index :
- 0
- _FillValue :
- -9223372036854775808
array([[ 445, 446, 447, 448, 444, -9223372036854775808], [ 451, 452, 453, 449, 450, -9223372036854775808], [ 454, 455, 456, 457, 458, -9223372036854775808], ..., [ 1789, 441, 1106, 1111, 443, 1790], [ 1790, 442, 1098, 1097, 441, 1788], [ 1789, 1788, 443, 1100, 1105, 442]])
- edge_face_connectivity(n_edge, two)int641789 1790 1788 ... 1318 1319 1320
- cf_role :
- edge_face_connectivity
- long name :
- Faces that neighbor each edge
- start_index :
- 0
- _FillValue :
- -9223372036854775808
array([[1789, 1790], [1788, 1789], [1786, 1787], ..., [1106, 1107], [1315, 1318], [1319, 1320]])
- face_node_connectivity(n_face, n_max_face_nodes)int642 3 4 0 1 ... 2959 3689 2951 2950
- cf_role :
- face_node_connectivity
- long name :
- Maps every face to its corner nodes.
- start_index :
- 0
- _FillValue :
- -9223372036854775808
array([[ 2, 3, 4, 0, 1, -9223372036854775808], [ 6, 7, 8, 9, 5, -9223372036854775808], [ 14, 10, 11, 12, 13, -9223372036854775808], ..., [ 2943, 2948, 3695, 2955, 2960, 3946], [ 2950, 2949, 3686, 2944, 2943, 3946], [ 3946, 2960, 2959, 3689, 2951, 2950]])
- face_edge_connectivity(n_face, n_max_face_edges)int641798 2207 2233 ... 2972 767 3766
- cf_role :
- face_edge_connectivity
- long name :
- Maps every face to its edges.
- start_index :
- 0
- _FillValue :
- -9223372036854775808
array([[ 1798, 2207, 2233, 2756, 2023, -9223372036854775808], [ 518, 2743, 1647, 2192, 2883, -9223372036854775808], [ 2136, 3140, 2297, 2910, 2148, -9223372036854775808], ..., [ 1, 3764, 5572, 5580, 3774, 864], [ 0, 451, 5552, 5549, 3787, 1], [ 0, 864, 3520, 2972, 767, 3766]])
- edge_node_connectivity(n_edge, two)int643946 2950 3946 ... 3773 3774 1183
- cf_role :
- edge_node_connectivity
- long name :
- Maps every edge to the two nodes that it connects.
- start_index :
- 0
array([[3946, 2950], [3946, 2943], [3945, 2931], ..., [3694, 733], [2520, 3773], [3774, 1183]])
- node_face_connectivity(n_node, n_max_node_faces)int640 448 444 445 ... 1789 1788 1790
- cf_role :
- node_face_connectivity
- long name :
- Faces that neighbor each node
- start_index :
- 0
- _FillValue :
- -9223372036854775808
array([[ 0, 448, 444], [ 445, 0, 444], [ 445, 446, 0], ..., [ 1784, 1783, -9223372036854775808], [ 1786, 1785, 1787], [ 1789, 1788, 1790]])
- face_areas(n_face)float641.544e+11 1.544e+11 ... 2.056e+11
- cf_role :
- face_areas
- long_name :
- Area of each face.
array([1.54356679e+11, 1.54356671e+11, 1.54356679e+11, ..., 2.05569717e+11, 2.05569711e+11, 2.05569714e+11])
- n_nodes_per_face(n_face)int645 5 5 5 5 5 6 6 ... 6 6 6 6 6 6 6 6
- cf_role :
- n_nodes_per_face
- long name :
- Number of nodes per face
array([5, 5, 5, ..., 6, 6, 6])
- edge_face_distances(n_edge)float644.85e+05 4.85e+05 ... 4.973e+05
- cf_role :
- edge_face_distances
- long_name :
- Distances between the face centers that saddle each edge
array([485043.30496367, 485043.30497902, 485043.29817844, ..., 485257.26806516, 487744.75389715, 497267.02740464])
- edge_node_distances(n_edge)float642.853e+05 2.853e+05 ... 2.62e+05
- cf_role :
- edge_node_distances
- long_name :
- Distances between the nodes that make up each edge.
array([285298.40090449, 285298.42467823, 285298.39522781, ..., 283573.13698969, 274517.22789552, 261978.54516178])
- on_a_sphere :
- YES
- sphere_radius :
- 6371229.0
- is_periodic :
- NO
- parent_id :
- kufh9o2jwx lsd2k42w1r a4x6sqhkwb
- history :
- Tue Oct 10 16:52:25 2023: ./convert.py MpasMeshConverter.x ocean.QU.480km.151209.nc ocean.QU.480km.20231010.nc mpirun -n 2 ./ocean_model
- mesh_spec :
- 1.0
- Conventions :
- MPAS
- source :
- MpasMeshConverter.x
- file_id :
- 85scxk6tmk
Each UxDataArray
under a UxDataset
is linked to the same Grid
object
uxds.uxgrid == uxds["bottomDepth"].uxgrid
True