Skip to content

Add Azimuthal Averaging #1255

Merged
philipc2 merged 26 commits intoUXARRAY:mainfrom
jpan84:azimuthal_mean
Sep 16, 2025
Merged

Add Azimuthal Averaging #1255
philipc2 merged 26 commits intoUXARRAY:mainfrom
jpan84:azimuthal_mean

Conversation

@jpan84
Copy link
Collaborator

@jpan84 jpan84 commented May 14, 2025

Closes #1254

Compute azimuthal mean in radial rings around a central point.

Overview

Like uxarray.UxDataArray.zonal_mean(), this aggregates over faces to output the data with a new horizontal dimension radius. Following uxarray.UxDataArray.subset.bounding_circle, this function uses ball_tree.query_radius to select grid elements in a circular neighborhood from one center coordinate. For radii r=[r1, r2, r3, ...], face centers at distance d (given in great-circle degrees), where r2<d<=r3 will be used for the azimuthal mean at r3.

This is one solution for issue #1254

This may be tangentially relevant to issue #930.

Expected Usage

import uxarray as ux
import matplotlib.pyplot as plt

grid_path = '/glade/p/cesmdata/inputdata/share/scripgrids/ne120np4_pentagons_100310.nc'
data_path = '/glade/work/jpan/azim_test_data.nc'

uxds = ux.open_dataset(grid_path, data_path)
uxda = uxds['OMEGA500']
print(uxda)

azim_mean, hit_count = uxda.azimuthal_mean((183., -18.933), 5, 0.3)

print(azim_mean)
print(hit_count)
plt.plot(azim_mean.radius, azim_mean.isel(time=0))
plt.show()

PR Checklist

General

  • [✓] An issue is linked created and linked
  • Add appropriate labels
  • [✓] Filled out Overview and Expected Usage (if applicable) sections

Testing

  • Adequate tests are created if there is new functionality
  • Tests cover all possible logical paths in your function
  • Tests are not too basic (such as simply calling a function and nothing else)

Documentation

  • [✓ ] Docstrings have been added to all new functions
  • [N/A ] Docstrings have updated with any function changes
  • [N/A] Internal functions have a preceding underscore (_) and have been added to docs/internal_api/index.rst
  • User functions have been added to docs/user_api/index.rst

Examples

  • Any new notebook examples added to docs/examples/ folder
  • Clear the output of all cells before committing
  • New notebook files added to docs/examples.rst toctree
  • New notebook files added to new entry in docs/gallery.yml with appropriate thumbnail photo in docs/_static/thumbnails/

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Compute azimuthal mean in radial rings around a central point.

5 participants