Skip to main content

spharmgrid

CI Documentation Status PyPI version PyPI Python Version GitHub License DOI

Spherical harmonic tools for filtering, regridding, and kinematics in atmospheric science with xarray.

spharmgrid (spherical harmonic gridding) implements spherical harmonic filtering, regridding, differential operators, and atmospheric kinematics for global xarray fields. It computes relative vorticity, divergence, streamfunction, velocity potential, Helmholtz decomposition, and inverse wind transforms. DUCC performs the numerical spherical harmonic transforms.

Supported grids are full rectangular Gauss–Legendre (GL) and pole-including Clenshaw–Curtis (CC) grids.

Install

Install with either pip or uv:

pip install spharmgrid
uv add spharmgrid

Optional groups are:

  • spharmgrid[dask] — Dask-backed lazy execution;
  • spharmgrid[cf] — optional cf-xarray coordinate discovery;
  • spharmgrid[cli] — command-line NetCDF, Zarr, and GRIB I/O.

Dask-backed transforms execute lazily. DUCC uses four threads per transform. For the local Dask scheduler, spharmgrid sets num_workers=max(1, os.cpu_count() // 4) unless num_workers is configured.

For a standalone command-line installation:

uv tool install "spharmgrid[cli]"

For a project environment, install the CLI extra with either:

uv add "spharmgrid[cli]"
pip install "spharmgrid[cli]"

Quick start

Importing spharmgrid registers the .sg accessor on xarray objects. This example applies a T6–42 spectral filter to a DataArray:

import xarray as xr
import spharmgrid

field = xr.open_dataarray("msl.nc")
filtered = field.sg.filter("T6-42")

See the Quick start for regridding, atmospheric wind diagnostics, direct-function equivalents, and further examples.

Documentation

The optional CLI reads NetCDF, Zarr, and GRIB and writes NetCDF and Zarr. See the CLI documentation for installation and usage.

See the full documentation for grid requirements, coordinate handling, CF metadata, atmospheric kinematics, inverse transforms, zero-mode conventions, and command-line use.

References

See the documentation References for the scientific literature and software cited by spharmgrid.

License

spharmgrid is distributed under the BSD 3-Clause License.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

spharmgrid-0.1.0.tar.gz (125.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

spharmgrid-0.1.0-py3-none-any.whl (35.7 kB view details)

Uploaded Python 3

File details

Details for the file spharmgrid-0.1.0.tar.gz.

File metadata

  • Download URL: spharmgrid-0.1.0.tar.gz
  • Upload date:
  • Size: 125.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for spharmgrid-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a16225d495b26d1774b5bedc6688b6a448cb73e69bbad22cb7d7ddef23b21c31
MD5 2cba7fec0348ffc9a0ed7a856db4600d
BLAKE2b-256 19801f2d62827eae0de37c1f9f7c029617a47076c68b1dae422fedb7aaa42570

See more details on using hashes here.

Provenance

The following attestation bundles were made for spharmgrid-0.1.0.tar.gz:

Publisher: python-publish.yml on mwyau/spharmgrid

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file spharmgrid-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: spharmgrid-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 35.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for spharmgrid-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6a73b613126e9db479dc9a43b8ef4e3e3108d7f0ef3b6f49a052242e5b57b8e3
MD5 e1c835599f3a80ff1028814bd001fdc7
BLAKE2b-256 66d977c4a01649b8c378ba69b40a493db657031dc2e55003cfd816c27e3db687

See more details on using hashes here.

Provenance

The following attestation bundles were made for spharmgrid-0.1.0-py3-none-any.whl:

Publisher: python-publish.yml on mwyau/spharmgrid

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page