UXARRAY / uxarray

Xarray-styled package for reading and directly operating on unstructured grid datasets following UGRID conventions
https://uxarray.readthedocs.io/
Apache License 2.0
139 stars 30 forks source link

Optimized ` get cartesian face edge nodes` ` get lonlat rad face edge nodes` #798

Closed hongyuchen1030 closed 1 month ago

hongyuchen1030 commented 1 month ago

Related to #730 and #785

Overview

Expected Usage

import uxarray as ux
import numpy as np

# Define vertices
vertices = [[0.5, 0.5, 0.5], [-0.5, 0.5, 0.5], [-0.5, -0.5, 0.5], [0.5, -0.5, 0.5]]

# Normalize the vertices
vertices = [x / np.linalg.norm(x) for x in vertices]

# Construct the grid from the vertices
grid = ux.Grid.from_face_vertices(vertices, latlon=False)

# Compute Cartesian face edge nodes
face_edges_connectivity_cartesian = _get_cartesian_face_edge_nodes(
    grid.face_node_connectivity.values,
    grid.node_x.values,
    grid.node_y.values, grid.node_z.values
)

PR Checklist

General

Testing

Documentation

Examples