healpix_geo.zuniq.healpix_to_lonlat#

healpix_geo.zuniq.healpix_to_lonlat(ipix, ellipsoid, num_threads=0)#

Get the longitudes and latitudes of the center of some HEALPix cells.

Parameters:
  • ipix (numpy.ndarray) – The HEALPix cell indexes given as a np.uint64 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 as cdshealpix.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:

lon, lat (numpy.ndarray) – The coordinates of the center of the HEALPix cells given as a longitude, latitude tuple.

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.zuniq import healpix_to_lonlat
>>> import numpy as np
>>> ipix = np.array([42, 6, 10])
>>> lon, lat = healpix_to_lonlat(ipix, ellipsoid="WGS84")
>>> lon
array([44.99999975, 45.00000008, 44.99999992])
>>> lat
array([2.85869025e-07, 1.42934512e-07, 1.42934512e-07])