ndcube
A package for multi-dimensional contiguous and non-contiguous coordinate aware arrays.
What it is and what it does
ndcube is a SunPy-affiliated package that wraps multi-dimensional arrays with coordinate awareness, units, uncertainties, and metadata into a unified interface. It is designed to handle scientific data of any number of dimensions whose relationship to the real world can be described by World Coordinate System (WCS) translations—common in astronomy and solar physics. The package provides slicing, coordinate transformations, and plotting/animation capabilities across all array dimensions and axis types.
The core use case is working with observational or simulated data where array indices map to real-world coordinates (e.g., spatial positions, wavelengths, or times). Rather than managing coordinates separately, ndcube binds them to the data, so slicing the array automatically updates the coordinate system. It depends on astropy for units and WCS support, numpy for array operations, scipy for numerical methods, and gwcs for generalized coordinate transformations.
Use it for:
- Slice and inspect solar or astronomical imaging data while preserving WCS coordinate metadata and units.
- Transform multi-dimensional observational data between different coordinate systems (e.g., pixel to world coordinates).
- Visualize and animate multi-dimensional scientific datasets with automatic axis labeling from WCS metadata.
- Work with non-contiguous data arrays that share a common coordinate system.
- Build scientific analysis pipelines that require coordinate-aware array operations with uncertainty tracking.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
ndcube manipulates, inspects, and visualizes multi-dimensional coordinate-aware data arrays with unified slicing, units, uncertainties, and World Coordinate System (WCS) transformations.
Yes, if you work with multi-dimensional scientific data (especially astronomy or solar physics) that requires WCS coordinate transformations and unified slicing. The package is actively maintained, has low install friction, and integrates well with the astropy ecosystem. However, verify the license terms first—the metadata does not clearly specify one. Not necessary for general-purpose array manipulation.
Install
ndcube on PyPI
pip
pip install ndcubeuv
uv add ndcubepoetry
poetry add ndcubeInstalling ndcube
Before you install
Low install friction; pure Python wheel. Active maintenance with a release 65 days ago and commits through 2026-08-11. Depends on well-established packages (astropy, numpy, scipy, gwcs).
License in practice
License treatment is unclear—no SPDX identifier or raw license text is recorded in the package metadata. Verify the actual license before use in proprietary or restricted contexts.
Quickstart
pip install ndcube
import ndcube
import astropy.units as u
import numpy as np
data = np.random.rand(10, 20)
array = ndcube.NDCube(data, unit=u.Jy)
Requires Python >=3.11. astropy, gwcs, numpy, and scipy must be installed.
Verify before relying
- Actual license identifier and terms—metadata shows 'unclear' treatment with no SPDX or raw license field populated.
- Whether WCS coordinate transformations and plotting/animation capabilities are production-ready for all axis types (spatial, temporal, spectral, etc.).
- Performance characteristics and memory efficiency for very large multi-dimensional arrays.
Package facts
| License | not declared (unclear) |
| Python support | supports the current Python release (>=3.11) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 4 — astropy, gwcs, numpy, scipy |
| Maintenance | actively maintained — 65 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 99,324/month — #13,027 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: ndcube-2.4.1-py3-none-any.whl
Tags
More Scientific/Engineering packages
NumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
pandaspandas provides fast, flexible data structures…
permissive · top 100 on PyPI
scipyscipy provides numerical algorithms for…
permissive · top 100 on PyPI
scikit-learnscikit-learn provides a comprehensive Python…
permissive · top 1,000 on PyPI
dilldill extends Python's pickle module to…
permissive · top 1,000 on PyPI
multiprocessMultiprocess is an enhanced fork of Python's…
permissive · top 1,000 on PyPI
gwcsGWCS provides tools for managing World…
unclear · top 15,000 on PyPI
sunpySunPy provides Python tools for accessing,…
permissive · top 15,000 on PyPI
xarrayxarray adds dimension, coordinate, and…
permissive · top 5,000 on PyPI
spatial_imagespatial-image provides an N-dimensional spatial…
permissive · top 15,000 on PyPI
asdf-wcs-schemasProvides ASDF schemas for validating World…
unclear · top 15,000 on PyPI
sparseProvides multi-dimensional sparse array data…
permissive · top 5,000 on PyPI
reprojectReproject astronomical images between different…
permissive · top 15,000 on PyPI
odc-loaderConstructs xarray objects from parsed…
permissive · top 15,000 on PyPI
awkward0Manipulates complex, non-rectangular data…
permissive · top 15,000 on PyPI
arraykitArrayKit provides C-extension implementations…
permissive · top 15,000 on PyPI