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()
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 0x788110598590>
out = healpix.to_rotated_pixelization(grid.lon)
plt.imshow(out)
<matplotlib.image.AxesImage object at 0x788110451a30>
Total running time of the script: (0 minutes 0.974 seconds)