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
Recommended nside per dataset
The nside whose approximate sampling distance is closest to each supported reader’s native pixel size:
Native pixel size |
nside |
Approximate sampling distance |
Readers |
|---|---|---|---|
0.3–0.5 km |
16384 |
0.40 km |
sentinel3_ol_1_efr, sentinel3_ol_2_wfr (300 m); sentinel3_sl_1_rbt 500 m channels; mtg_fci_l1c_nc 500 m channels |
~1 km |
8192 |
0.80 km |
mtg_fci_l1c_nc 1 km channels; msg15nat HRV; metop_avhrrl1; sentinel3_sl_1_rbt 1 km channels; sentinel3_wst; sentinel3_frp (1 km grid); metop_edlst (0.01°) |
1.2–2 km |
4096 |
1.59 km |
mtg_fci_l1c_nc 2 km channels; mtg_l2_clm, mtg_l2_oca, mtg_l2_olr; mtg_li_af, mtg_li_afa, mtg_li_afr (gridded); sentinel3_ol_1_err, sentinel3_ol_2_wrr |
3 km |
2048 |
3.18 km |
msg15nat VIS/IR |
5–6 km |
1024 |
6.37 km |
metop_glbsst (0.05°); mtg_l2_gii (6 km FoR) |
10–16 km |
512 |
12.7 km |
sentinel3_aod (9.5 km); metop_iasil1c_all, metop_iasisnd02, metop_iasthr011 (~12 km); metop_ascszr1b, metop_ascszrr02, metop_somo12, metop_osi104, metop_osi150b (12.5 km); metop_mhsl1 (~16 km) |
20–32 km |
256 |
25.5 km |
metop_hirsl1, metop_hirs_fdr (~20 km); metop_ascszf1b, metop_ascszfr02, metop_ascszo1b, metop_ascszor02, metop_somo25, metop_osi150a (25 km); mtg_l2_asr (32 km FoR) |
40–80 km |
128 |
50.9 km |
metop_amsul1 (~48 km); metop_gomel1, metop_gomel1r03 (80 × 40 km) |
The 16384 and 8192 rows state the matching value, not an endorsement: check the memory figures above first. A coarser, aggregating nside is often the practical choice, subject to the aliasing caveat above.
HEALPix reprojection rejects point and sparse products (LI point mode, FCI and AVHRR atmospheric motion vectors, the SWIR-only FRP variant) and SRAL 1-D along-track data.
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.