HEALPix nside selection

HEALPix is a way of dividing the sphere into equal-area cells, used by many weather models. Its average sampling distance is set by the nside in the target string, for example target="healpix:1024"; nside must be a power of two. The output always covers the full globe with 12 × nside² equal-area cells regardless of what the source covers, so each step up in nside quadruples the output size. The index and the longitude and latitude coordinates are computed up front: at nside 8192 they take about 19 GB plus 3.2 GB per float32 variable per time step, and at nside 16384 about 77 GB.

Start from the source’s native pixel size. The nside whose average sampling distance is closest to it (the values in the table below) keeps the output compact at a small cost in detail; one step finer preserves the native resolution (the HEALPix Primer recommends cells smaller than the instrument resolution to limit discretisation and pixel-shape smoothing) at 4× the cells.

A deliberately coarser nside samples the source more sparsely, and no single resampling method is right for every case. As a starting point, resampling="mean" usually suits continuous variables and "nearest" categorical ones, but the better choice depends on the data and on what the output is for. Coarser sampling can also introduce aliasing: detail finer than the output cells reappears as false structure at the output scale instead of averaging away, and "nearest" samples without averaging first, so it aliases more than "mean". A land-water mask shows the risk. Coarsen one by several levels with "nearest" and a cell can come out water although nearly all the area it covers is land. DEFAIR’s "nearest" goes further: it preserves the source’s extreme values and where they fall, so on a two-value mask every cell holding any pixel of the higher-coded class comes out as that class.

A HEALPix target accepts one further method, resampling="idw", which interpolates each cell from the nearest source points. See Transform data for what each method does.

nside reference

The approximate sampling distance is the square root of the pixel area, √(π/3)/nside radians, about 58.6°/nside or 6520 km/nside (cells are equal-area but vary in shape). Level is the CF refinement_level (nside = 2^level) written to the output’s healpix_grid mapping variable.

nside

Level

Approximate sampling distance

Cells

32

5

1.83° / 204 km

12,288

64

6

0.916° / 102 km

49,152

128

7

0.458° / 50.9 km

196,608

256

8

0.229° / 25.5 km

786,432

512

9

0.115° / 12.7 km

3,145,728

1024

10

0.0573° / 6.37 km

12,582,912

2048

11

0.0286° / 3.18 km

50,331,648

4096

12

0.0143° / 1.59 km

201,326,592

8192

13

0.0072° / 0.80 km

805,306,368

16384

14

0.0036° / 0.40 km

3,221,225,472

For a sampling distance not listed:

from astropy import units as u
from astropy_healpix import pixel_resolution_to_nside

pixel_resolution_to_nside((3 / 6371) * u.rad)  # 3 km native pixels -> 2048

What to do next

With an nside value selected, follow Transform data to reproject your data to HEALPix. To compare the result with geographic and Lambert grids, work through Reprojecting to EPSG:4326, HEALPix and Lambert.