healpix_geo.auto.lonlat_to_healpix#

healpix_geo.auto.lonlat_to_healpix(lon, lat, grid, *, num_threads=0)#

Get the HEALPix indexes that contains specific points.

Parameters:
  • lon (numpy.ndarray) – The longitudes of the input points, in degrees.

  • lat (numpy.ndarray) – The latitudes of the input points, in degrees.

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

Examples

>>> import healpix_geo.auto as hg
>>> import numpy as np
>>> lon = np.array([0, 50, 25], dtype="float64")
>>> lat = np.array([6, -12, 45], dtype="float64")
>>> grid = hg.Grid(level=3, indexing_scheme="nested", ellipsoid="WGS84")
>>> ipix = hg.lonlat_to_healpix(lon, lat, grid)
>>> ipix
array([304, 573,  38], dtype=uint64)