Note
Go to the end to download the full example code.
HealPIX Pixelization#
HealPIX maps can be viewed as a 2D image rotated by 45 deg or alternatively with double pixelization that is not rotated. This is useful for quick visualization with image viewers without distorting the native pixels of the image.
import matplotlib.pyplot as plt
import numpy as np
from earth2grid import healpix
n = 8
npix = 12 * n * n
ncap = 2 * n * (n - 1)
p = np.arange(npix)
grid = healpix.Grid(healpix.nside2level(n))
i, jp = healpix.ring2double(n, p)
plt.figure(figsize=(10, 3))
# plt.scatter(jp, i, c=grid.lon[p])
plt.scatter(jp + 1, i, c=grid.lon[p])
plt.grid()

/Users/nbrenowitz/workspace/nvidia/earth2grid/earth2grid/healpix/core.py:112: UserWarning: healpixpad_cuda module not available, reverting to CPU for all padding routines
warnings.warn("healpixpad_cuda module not available, reverting to CPU for all padding routines")
n = 4
npix = 12 * n * n
ncap = 2 * n * (n - 1)
p = np.arange(npix)
grid = healpix.Grid(healpix.nside2level(n))
out = healpix.to_double_pixelization(grid.lon)
plt.imshow(out)

<matplotlib.image.AxesImage object at 0x156acb4a0>
out = healpix.to_rotated_pixelization(grid.lon)
plt.imshow(out)

<matplotlib.image.AxesImage object at 0x156ab9bb0>
Total running time of the script: (0 minutes 1.275 seconds)