Skip to main content

healpix-plot

Fast, practical static plots of HEALPix data with matplotlib and cartopy — with ellipsoidal (WGS84) support for geoscience workflows.

License: Apache 2.0 Python


Overview

healpix-plotting prioritises getting a usable figure quickly over perfectly accurate cell-geometry rendering. It rasterises HEALPix data via nearest-neighbour resampling onto a regular lon/lat grid and renders the result with Cartopy's imshow.

Unlike astronomy-focused HEALPix tools, this library is built with Earth observation and geoscience in mind: the underlying coordinate operations are provided by healpix-geo, which supports geodetically correct reference ellipsoids such as WGS84.

The library is well suited for:

  • Exploratory analysis and quality control of EO / climate data
  • Debugging and sanity checks
  • Quick snapshots for reports and discussions

It is not intended as a true boundary-polygon renderer.


Dependencies

Package Role
healpix-geo Core HEALPix ↔ lon/lat conversions, ellipsoid support
cartopy Map projections and rendering
matplotlib Figure/axes backend
numpy Array operations
numpy-groupies Aggregation during duplicate-cell-id deduplication
affine Affine transform support for AffineSamplingGrid
scipy Reserved for future bilinear interpolation

Installation

pip install healpix-plotting

How it works

  1. Build a target sampling grid — a regular lon/lat grid inferred from the data, defined by a bounding box, or specified via an affine transform.
  2. Resample — each sampling point is mapped to a HEALPix cell id and filled by nearest-neighbour lookup (with optional aggregation for duplicate ids).
  3. Render — the resulting raster is drawn on a Cartopy axis with imshow(..., transform=PlateCarree()).

Because the library rasterises via nearest-neighbour resampling, it does not attempt exact polygon boundary filling.

Ellipsoidal support

Standard HEALPix was originally defined on the unit sphere. For geoscience applications — such as Earth observation, numerical weather prediction, or climate modelling — coordinates are commonly expressed in geodetic lon/lat on a reference ellipsoid (most often WGS84).

healpix-plotting delegates coordinate conversions to healpix-geo, which implements ellipsoidal HEALPix conversions. Passing ellipsoid="WGS84" to HealpixGrid propagates this choice through all internal operations.

For a full explanation of how ellipsoidal HEALPix works, see the healpix-geo ellipsoids tutorial.


Things to keep in mind

HEALPix is a spherical tessellation. Depending on your use case you may need to consider:

  • True cell boundaries — cells are not lon/lat rectangles; boundaries are curved on the sphere.
  • Projection effects — any map projection changes apparent cell geometry.
  • Resolution and aliasing — the target sampling-grid resolution determines sharpness and artifact level.
  • Dateline and polar behaviour — extent wrapping and polar distortion can introduce discontinuities.
  • Sphere vs. ellipsoid — for precise geoscience work, prefer ellipsoid="WGS84" over the default "sphere".

Limitations

  • Rendering is raster-based; exact HEALPix cell boundaries are not drawn.
  • Output quality depends on the sampling-grid resolution (speed vs. aliasing trade-off).
  • "bilinear" interpolation is currently not implemented (raises NotImplementedError).
  • The helper pattern healpix_grid.operations.healpix_to_lonlat(cell_ids, **healpix_grid.as_keyword_params()) does not work for indexing_scheme="zuniq" — see the caveat in HealpixGrid.

Alternatives

Library Best for
healpy Conventional HEALPix map visualisation; mollview and friends. Sphere only.
earthkit-plots Publication-quality figures in the ECMWF / earthkit stack.
xdggs Analysis/selection workflows and polygon-based rendering with true cell boundaries.

Choosing a tool

Need a quick geoscience plot (EO, NWP, climate)?  → healpix-plotting  ✓  (WGS84 support)
Working in the ECMWF/earthkit ecosystem?           → earthkit-plots    ✓
Need exact cell boundaries / polygon operations?   → xdggs             ✓
Standard healpy full-sky (astronomy) workflow?     → healpy            ✓

Implementation notes

Nearest-neighbour resampling

For each sampling-grid point, the corresponding HEALPix cell id is computed. Ids not present in the source data are masked; the remaining values are placed into the raster using searchsorted-based indexing.

Aggregation

Before resampling, duplicate cell_ids are collapsed with numpy-groupies using the function specified by agg (default: "mean"). The sorted unique ids are then used as the lookup table for the raster fill.

Cartopy rendering

Plotting uses imshow with transform=ccrs.PlateCarree() and interpolation="nearest". For non-global subsets, the extent is set before plotting to obtain a smoother result with Cartopy.

Download files

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

Source Distribution

healpix_plot-2026.7.0.tar.gz (39.1 kB view details)

Uploaded Source

Built Distribution

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

healpix_plot-2026.7.0-py3-none-any.whl (20.0 kB view details)

Uploaded Python 3

File details

Details for the file healpix_plot-2026.7.0.tar.gz.

File metadata

  • Download URL: healpix_plot-2026.7.0.tar.gz
  • Upload date:
  • Size: 39.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for healpix_plot-2026.7.0.tar.gz
Algorithm Hash digest
SHA256 0af69c02bd91145f2326b8dbaa548a28d3bc35c7ac5c12ca11b97f26f9bb849b
MD5 79bb47e1b00d4d4230c1949ce09f6080
BLAKE2b-256 864a55b6bc00439b2ccd6537c264fe03502b181bc5bcef19b800416e22c7dfc6

See more details on using hashes here.

Provenance

The following attestation bundles were made for healpix_plot-2026.7.0.tar.gz:

Publisher: pypipublish.yml on GRID4EARTH/healpix-plot

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

File details

Details for the file healpix_plot-2026.7.0-py3-none-any.whl.

File metadata

File hashes

Hashes for healpix_plot-2026.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5d6a451006ddb23cae3d5e43233704d1550de41f74869bf812912f2246667731
MD5 9073206e44e1bfe41a7b99213948c763
BLAKE2b-256 e48b9604e8ddaa49c0d870fa86fc1bbc52eb538b23551a08213e224e58810229

See more details on using hashes here.

Provenance

The following attestation bundles were made for healpix_plot-2026.7.0-py3-none-any.whl:

Publisher: pypipublish.yml on GRID4EARTH/healpix-plot

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

Release history Release notifications | RSS feed

This release

2026.7.0 This release

2 files

2026.5.1

2 files

0.1.1

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page