healpix_geo.auto.cartesian_to_healpix#

healpix_geo.auto.cartesian_to_healpix(x, y, z, grid, num_threads=0)#

Get the HEALPix indexes that contain specific points.

Parameters:
  • x (numpy.ndarray) – The x coordinate of the input points, in meters.

  • y (numpy.ndarray) – The y coordinate of the input points, in meters.

  • z (numpy.ndarray) – The z coordinate of the input points, in meters.

  • grid (Grid) – The definition of the HEALPix grid.

  • 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:

ipix (numpy.ndarray) – A numpy array containing all the HEALPix cell indexes stored as np.uint64.

Raises:
  • ValueError – When the number of longitudes and latitudes given do not match.

  • ValueError – When the name of the ellipsoid is unknown.

Examples

>>> import healpix_geo.auto as hg
>>> import numpy as np
>>> x = np.array([4728734.69011096, 3814362.85063174, 5302653.40426395])
>>> y = np.array([465739.71573273, 4647814.58136658, 2834327.29466645])
>>> z = np.array([4240471.60205904, 2121029.89621885, 2121029.89621885])
>>> grid = hg.Grid(level=3, indexing_scheme="nested", ellipsoid="WGS84")
>>> ipix = hg.cartesian_to_healpix(x, y, z, grid)
>>> ipix
array([42,  6, 10], dtype=uint64)