skillfed

ndcube

A package for multi-dimensional contiguous and non-contiguous coordinate aware arrays.

ndcube v2.4.1 99.3K downloads/30d#13,027 on PyPI48
License unclear Active released

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 ndcube

uv

uv add ndcube

poetry

poetry add ndcube

Installing 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

multi-dimensional array coordinate transformationWCS world coordinate system datascientific data visualization slicingndarray with units and metadataastronomical data cube handling
wcs-coordinatesastronomical-datasunpy-affiliated

More Scientific/Engineering packages