Skip to main content

spharmgrid

CI Documentation Status codecov PyPI version PyPI Python Version Conda Version GitHub License

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 Clenshaw–Curtis (CC) grids.

Install

Install with either pip, uv, or conda:

pip install spharmgrid
uv add spharmgrid
conda install -c conda-forge 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.

Without Dask installed, spharmgrid lets DUCC use its default thread count. With Dask support installed, 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.1.tar.gz (136.5 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.1-py3-none-any.whl (35.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: spharmgrid-0.1.1.tar.gz
  • Upload date:
  • Size: 136.5 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.1.tar.gz
Algorithm Hash digest
SHA256 89e98d4468f0bfe286efc4a63178147bf1390b06dd32ff84f2e90606454f2ca4
MD5 1c1b34659658bf2b24b58a0705a5b8b1
BLAKE2b-256 4be88cd2ebac114509a15a8173f52cfed67e2c293aa850d0d2e66b0fa796d9ef

See more details on using hashes here.

Provenance

The following attestation bundles were made for spharmgrid-0.1.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: spharmgrid-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 35.9 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5438ee8f45d79e927169492d7f456ca64d36272b6598ff298e6d9be5190331b9
MD5 1829919c0b3c1c3e1ba55b7250c6f032
BLAKE2b-256 2ca393c24d6238cc8e93228031afac0f26b4b7846225cd4df55dc123e8d8cc09

See more details on using hashes here.

Provenance

The following attestation bundles were made for spharmgrid-0.1.1-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

This release

0.1.1 This release

2 files

0.1.0

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