Skip to content

Implements Grid.compute_skewness(..., method="equiangle") - #1687

Open
Sevans711 wants to merge 5 commits into
mainfrom
sevans/skewness-equiangle
Open

Implements Grid.compute_skewness(..., method="equiangle")#1687
Sevans711 wants to merge 5 commits into
mainfrom
sevans/skewness-equiangle

Conversation

@Sevans711

@Sevans711 Sevans711 commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator

Closes #1686

Overview

Creates Grid.compute_skewness and implements Grid.compute_skewness(..., method="equiangle"). This computes the skewness of all faces based on the equiangle method. See #1686 for more detailed description.

Similarly to Grid.compute_face_node_angles, the result is an xarray.DataArray by default, but can be returned as a UxDataArray if desired, by setting as_uxarray=True.

Tiny expansion of scope: clarifies in _compute_face_node_angles_convex docstring that the angles there are returned in radians.

Expected Usage

import uxarray as ux

grid_path = "/path/to/grid.nc"
data_path = "/path/to/data.nc"

uxds = ux.open_dataset(grid_path, data_path)
grid = uxds.uxgrid   # or use: ux.open_grid(grid_path)

# result is an xarray.DataArray by default
skewness = grid.compute_skewness()

# Easier to visualize when getting result as UxDataArray instead:
skewness_as_uxarray = grid.compute_skewness(as_uxarray=True)
skewness_as_uxarray.plot()

PR Checklist

General

  • An issue is created and linked
  • Added appropriate labels (if your uxarray repo permissions allow it)
  • Filled out Overview and Expected Usage (if applicable) sections

Testing & Benchmarking

  • Adequate tests are created if there is new functionality
  • Tests are not too basic (such as simply calling a function and nothing else)
  • Tests cover all major paths in your new functions
  • [N/A] If this PR could affect performance, ran ASV benchmarks and confirmed they show expected behavior (add a new benchmark if necessary)

Documentation

  • Docstrings have been added to all new functions
  • [N/A] Docstrings have been updated with any function changes
  • User (public) functions have been added to docs/api.rst
  • Internal (private) function names start with an underscore (_)

AI Disclosure

AI Usage: GitHub Copilot's inline code suggestions, plus chats with Claude, ChatGPT, Gemini for learning about skewness.

  • I take responsibility for all AI-generated content in my PR.
  • I have tested all AI-generated content in my PR.

@Sevans711 Sevans711 added the new feature New user-facing functionality label Aug 19, 2026
also swaps to allowing "method" kwarg as a positional arg.

(formula typo was Amin - Areg, but now fixed to Areg - Amin)
@Sevans711
Sevans711 marked this pull request as ready for review August 20, 2026 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new feature New user-facing functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Determine the Skewness of a Grid using "equiangle" method

1 participant