healpix_geo.ring.healpix_to_cartesian#
- healpix_geo.ring.healpix_to_cartesian(ipix, depth, ellipsoid='sphere', num_threads=0)#
Get the cartesian coordinates of the center of the given HEALPix cells.
- Parameters:
ipix (numpy.ndarray) – The HEALPix cell indexes given as a np.uint64 numpy array.
depth (numpy.ndarray) – The HEALPix cell depth given as a np.uint8 numpy array.
ellipsoid (ellipsoid-like, default:
"sphere") – Reference ellipsoid to evaluate healpix on. If the reference ellipsoid is spherical, this will return the same result ascdshealpix.nested.healpix_to_lonlat().num_threads (
int, optional) – Specifies the number of threads to use for the computation. Default to 0 means it will choose the number of threads based on the RAYON_NUM_THREADS environment variable (if set), or the number of logical CPUs (otherwise)
- Returns:
x, y, z (
numpy.ndarray) – The coordinates of the center of the HEALPix cells.- Raises:
ValueError – When the HEALPix cell indexes given have values out of \([0, 4^{29 - depth}[\).
ValueError – When the name of the ellipsoid is unknown.
Examples
>>> from healpix_geo.ring import healpix_to_cartesian >>> import numpy as np >>> ipix = np.array([42, 6, 10]) >>> depth = 3 >>> x, y, z = healpix_to_cartesian(ipix, depth, ellipsoid="WGS84") >>> x array([2223448.21176852, -495094.69891854, 495094.69891854]) >>> y array([ 2223448.21176852, 1195264.33678817, -1195264.33678817]) >>> z array([5530555.70358274, 6224606.75696243, 6224606.75696243])