# Whole-Moon Sun and Earth visibility: method, choices, convergence and validation **Status:** done. The full run `v1` finished on 2026-11-17 (758 tiles in 2.57 h). The web layers are in `web/data/illum/`, the numbers in `docs/validation/global_visibility.json` and the figures in `docs/figures/global_visibility/`. The run uses a new dependency (numba); the committed data size is 9.45 MB. **In short.** Both polar caps match NASA's PGDA maps (Mazarico et al. 2011 method) pixel by pixel on the same 240 m grid. In the south the mean difference is +0.15 pp, the RMS 1.08 pp and the correlation 0.9974. In the north the mean is +0.60 pp, the RMS 1.40 pp and the correlation 0.9961. Our never-lit area is 18 250 km² in the south and 15 467 km² in the north, against PGDA's 18 440 km² and 15 722 km², and the two maps share 97 % of it. Away from the poles the Sun is up 49 % of the time (median within 30° of the equator). The Earth is always in view on 40 % of the ground within 80.5° of the equator and never on 44 %. ![Whole Moon: Sun and Earth](../figures/global_visibility/global_sun_earth.png) ## 1. What it is For every pixel of the Moon, the simulation gives the share of time the **Sun** and the **Earth** are visible over one full 18.6-year cycle (2026-01-01 to 2044-08-12, 6798 days). PSRs and peaks of near-eternal light are not two separate products here: they are the two ends of one continuous Sun map (0 % is permanent shadow, the highest values are the best ridges). The Earth map shows the far side at 0 %, the libration band near the limb, and the craters near the limb and the poles that hide the Earth. Outputs per pixel (`moonat.illum.job.OUT_NAMES`): - `sun_mean`: time average of the visible fraction of the solar disk. This is the layer "Sunlight (% of time)". - `sun_any`: share of time steps with any part of the Sun visible (NASA's AVGVISIB definition). - `earth_mean`, `earth_any`: the same two for the Earth's disk. `earth_mean` is the layer "Earth in view (% of time)". - `dark_max_days`: the longest continuous run with no part of the Sun visible (night, terrain or eclipse). ## 2. Method (src/moonat/illum/) - **Grids** (`grids.py`). The polar caps (80–90°, both poles) use the globe's cap projection with 2560 px of 240 m. That is **the same pixel grid** as NASA's PGDA 240 m illumination crops and as LOLA LDEM_75S_240M, so we compare pixel by pixel and the layers line up with `web/data/overlays/`. The whole Moon uses an equirectangular grid at 8 px/deg (3.8 km at the equator) for |lat| ≤ 80.5°. Rows poleward of that are taken from the caps. - **Terrain** (`demstack.py`). The polar levels are LOLA LDEM_75S_240M and LDEM_75N_240M (240 m, 75–90°). The global levels are LDEM_16 (1.9 km). Each level is followed by its 2 × 2 mean pyramid (polar to 7.68 km, global to 2 px/deg). All of them are despiked as for contract C3. - **Horizons** (`kernel.pixel_horizon`). These use the C3 geometry. The Moon is a sphere of 1737.4 km plus the LOLA height, the eye is 2 m above the pixel's ground, and up is radial. For each of 360 azimuths, a ray follows the great circle. A terrain point at central angle θ is seen at `tan el = (ρ cos θ − r_E)/(ρ sin θ)`, which includes the curvature exactly. There is no refraction. The step along the ray is max(DEM cell, 0.01 × distance), and each sample reads the pyramid level that matches the step, so far terrain is smoothed at the scale of the step. A ray stops at the rigorous C3 bound: no terrain lower than the regional maximum height can rise above the current horizon once θ > acos(r_E cos el*/ρ_max) − el*. Rays are capped at 0.30 rad (521 km). - **Ephemeris** (`ephem.py`). The apparent Sun and Earth vectors seen from the Moon's centre come from skyfield, JPL DE421 and MOON_ME_DE421, with the chain validated against JPL Horizons to 0.055″ (docs/validation/ephem.md). There is one step every 4 h. Each pixel subtracts its own eye position, so the topocentric parallax is exact (it matters for the Earth: up to 0.26°). - **Disks** (`kernel.disk_vis`). The angular radius is asin(R/d), with R = 695 700 km for the Sun and 6378.137 km for the Earth. Across the disk, the horizon is a straight line through the profile at the disk's centre azimuth, with the slope of the chord between the azimuths at ± the half-width. The visible fraction is the exact circular-segment area. Against Moonat's 400-point disk sampling (`moonat.visibility`) this differs by at most 0.03 per step and by 0.000 pp on the 18.6-year mean (§5.3). - **Eclipses.** The Sun's fraction is multiplied by the share of its disk not covered by the Earth, seen from the Moon's centre (lens area). In the 40 788 four-hour steps of the 18.6 years, 36 fall in a partial or total eclipse (14 of them total). Together they lower the Sun's time average by 0.05 pp. - **Throughput.** numba is used for the compiled loops, 18 threads, one checkpoint per tile. ## 3. Choices and convergence tests (scripts/illum/convergence.py → global_visibility_convergence.json) The sample is 300 random pixels of the south cap (80–90° S, 240 m) and 100 random pixels of the global grid (|lat| ≤ 75°). The reference uses 1440 azimuths, ray growth 0.0025, 1-hour steps and the 2026 cycle. The table gives |difference| from the reference for the Sun layer in percentage points (pp), as mean / 95th percentile / max. | Setting changed | South cap, Sun | South cap, Earth (max) | Global, Sun (max) | Never-lit flips | |---|---|---|---|---| | 180 azimuths | 0.009 / 0.030 / 0.048 | 0.22 | 0.023 | 0 | | **360 azimuths (used)** | 0.002 / 0.007 / 0.016 | 0.04 | 0.008 | 0 | | 720 azimuths | 0.001 / 0.002 / 0.003 | 0.01 | 0.002 | 0 | | **ray growth 0.01 (used)** | 0.013 / 0.051 / 0.109 | 0.20 | 0.000 | 0 | | ray growth 0.02 | 0.052 / 0.181 / 0.362 | 0.62 | 0.008 | 0 | | ray growth 0.04 | 0.160 / 0.507 / 0.963 | 1.27 | 0.020 | 1 | | 2-hour steps | 0.001 / 0.001 / 0.003 | 0.000 | 0.011 | 0 | | **4-hour steps (used)** | 0.002 / 0.005 / 0.007 | 0.001 | 0.015 | 0 | | 6-hour steps | 0.003 / 0.009 / 0.014 | 0.002 | 0.040 | 0 | | **360 az + 0.01 together (used)** | 0.013 / 0.052 / 0.112 | 0.21 | 0.008 | 0 | Two more things to note. Over the 18.6 years the sampling error of the time average is random (the 4-h grid drifts against every lunar period), so the time step costs almost nothing. The longest-darkness output does depend on the step: its median change is 0, its 95th percentile is 0.25 days at 4 h, and it is resolved to the step (4 h). Its maximum change can be hundreds of days at nearly permanently shadowed pixels, where one brief glint splits an 18-year darkness in two. That output should be read as "about". **Averaging period.** It is sometimes said that the 18.6-year cycle sets the Sun's extreme latitudes over the poles. **A correction:** in the Cassini state the Sun's selenographic latitude always swings between about ±1.54° (the lunar equator's tilt to the ecliptic), once per eclipse year (346.6 d). What has to be averaged is how those swings pair with the lunar phase (the Sun's azimuth). That pairing repeats after one saros (18.03 y). The Earth's sub-point repeats after about 6 years (the beat of the anomalistic and draconic months). One nodal cycle (18.6 y) covers both, which is why NASA's maps (Mazarico et al. 2011) use it. The tests use the same pixels and horizons, 2-hour steps, and compare against the 2026–2044 cycle: | Window | South cap Sun, mean / max (pp) | South cap Earth, mean / max | Global Sun max | Global Earth max | |---|---|---|---|---| | previous cycle 2007–2026 | 0.09 / 0.42 | 0.04 / 0.31 | 0.11 | 0.45 | | cycle before 1988–2007 | 0.13 / 0.56 | 0.09 / 0.73 | 0.14 | 0.99 | | decade 2026–2036 | 0.05 / 0.14 | 0.38 / **2.59** | 0.17 | **3.09** | | decade 2034–2044 | 0.12 / 0.40 | 0.33 / 1.83 | 0.20 | 2.48 | | decade 2016–2026 | 0.15 / 0.53 | 0.38 / 1.95 | 0.24 | 2.49 | So a decade is good enough for the Sun (within 0.5 pp) but **not for the Earth** (up to 3 pp near the limb and the poles). Three consecutive 18.6-year cycles agree within 0.6 pp for the Sun and 1 pp for the Earth (means 0.1 pp). That spread is the real uncertainty from the choice of window, and a century would only average it down. We use one cycle. **Eye height.** The default is 2 m (contract C0, the same as the C3 site horizons). At the surface (0 m, as in the PGDA maps) the south-cap sample changes by a mean of 0.35 pp, a 95th percentile of 1.2 pp and a maximum of 5.3 pp, in the direction of less light. §5.1 compares both heights with PGDA. **Resolution.** The caps use 240 m, the resolution of NASA's 240 m maps and of the finest whole-cap LOLA DEM. Away from the poles, 8 px/deg (3.8 km) with LDEM_16 terrain. There, the Sun and Earth climb high every day and the result depends only on large-scale terrain (§6). ## 4. Pilot and full run `run_global_visibility.py pilot` (one 128 × 128 polar tile at 84–85° S and one 240 × 240 equatorial tile) on 20 threads, the computer otherwise idle: **1.48 ms per polar pixel and 0.52 ms per global pixel**. That gives 5.15 M px per cap (the inscribed circle) and 3.71 M global px, about 4.8 h in all. The full run took **2.57 h** on 18 threads (i7-12700H, 14 cores and 20 threads), from 2026-11-16 23:28 to 2026-11-17 02:03 local. The south cap took 1.75 h, at about 1.9 ms per pixel, while other jobs shared the CPU. The global grid took 0.25 h at 0.25 ms per pixel, and the north cap 0.57 h at 0.4 ms per pixel once the computer was free. Global pixels are cheap because the Sun and the Earth are far from the horizon most of the time. Command (detached background process): `uv run python scripts/illum/run_global_visibility.py run --threads 18` - Checkpoints: `data\cache\illum\v1\{south,global,north}\*.npz` (one per tile; order south cap, global, north cap). Progress and ETA: `data\cache\illum\v1\progress.log` and `status.json`, or `... run_global_visibility.py status`. - Resume after any stop: run the same command again. Finished tiles are skipped. `config.json` guards against mixing settings. ## 5. Validation (scripts/illum/validate_global_visibility.py → global_visibility.json) ### 5.1 South and north caps against NASA PGDA (Mazarico et al. 2011 method, 240 m, same grid) Each cap has 5.15 M pixels (294 183 km², 79.9–90°). A ±2 px shift search puts the best alignment at **(0, 0)** for both caps, so the grids coincide. Our `sun_any` is compared with AVGVISIB (both "any part of the Sun visible"): | | South | North | |---|---|---| | Mean difference (ours − PGDA) | **+0.15 pp** | **+0.60 pp** | | RMS / median abs. | 1.08 / 0.15 pp | 1.40 / 0.37 pp | | Correlation | **0.9974** | **0.9961** | | Mean, 79.9–85° / 85–88° / 88–90° | +0.12 / +0.20 / +0.42 pp | +0.50 / +0.86 / +1.20 pp | | Best pixel, any part visible | 93.9 % (PGDA 93.5 %) | 90.6 % (PGDA 89.1 %) | | Never-lit area, ours | **18 250 km²** | **15 467 km²** | | PGDA LPSR area (same pixels) | 18 440 km² | 15 722 km² | | Both / ours only / PGDA only | 17 979 / 270 / 460 km² | 15 165 / 301 / 557 km² | | Never-lit, 88–90° (ours / PGDA) | 2346 / 2341 km² | 1157 / 1186 km² | Our `sun_mean` (visible disk fraction) is 1.1 pp (south) and 0.7 pp (north) lower than AVGVISIB, as expected: AVGVISIB counts a step as lit if any part of the disk shows. Part of our small positive bias is the 2 m eye. On 300 random south-cap pixels the mean difference is +0.20 pp at 2 m and −0.16 pp at the surface (0 m, as PGDA), with an RMS of 1.0 pp either way. The rest grows toward the poles and is larger in the north. That fits a slightly different DEM version or time sampling (PGDA uses 1 h steps over its own 18.6-year window, and three of our windows differ by up to 0.6 pp, §3). Our never-lit area is 1.0 % (south) and 1.6 % (north) smaller than PGDA's, which fits the 2 m eye seeing over the lowest rims. ![South cap vs PGDA](../figures/global_visibility/south_sun_vs_pgda.png) ![North cap vs PGDA](../figures/global_visibility/north_sun_vs_pgda.png) ### 5.2 Earth and Sun near the south pole against PGDA's 60 m maps This compares our 240 m cap with the 4 × 4 block means of PGDA's 60 m Sun and **Earth** (AVGVISIB_85S_060M_201608_EARTH) maps over 89–90° S. It is the one independent check of the Earth layer: 67 600 pixels. The windows were already cached by the StarHab study, so nothing was downloaded. | 89–90° S, any part visible | Mean, ours / PGDA | Mean difference | RMS | Correlation | |---|---|---|---|---| | Sun | 18.6 % / 16.5 % | +2.1 pp | 4.2 pp | 0.975 | | Earth | 28.9 % / 27.2 % | +1.7 pp | 4.3 pp | 0.987 | This is the roughest ground on the map (Shackleton, Haworth and de Gerlache rims). At 60 m PGDA resolves walls and pits that a 240 m pixel averages away. The Earth layer agrees as well as the Sun layer does. ### 5.3 Catalog sites (C3 horizons) and the time integration This compares, for each of the 42 catalog sites (`sites` in the JSON), the map value at the site with the same time integration run on the site's own C3 horizon (0.25° azimuths, 20–60 m near field). Map minus C3: - **Sun:** median |d| **0.4 pp**, mean +1.3 pp. - **Earth:** median |d| **0.0 pp** (the near-side sites see the Earth all the time), mean +1.1 pp. The 26 sites away from the poles agree within 2.2 pp (Sun; median 0.3 pp) and exactly for the Earth (100 % for all of them). Where they differ, the map is a little higher than C3, by up to 2.2 pp (Surveyor 7 in Tycho's ejecta). The map's 1.9 km terrain has no near field, and the near hills block the low Sun at C3 resolution. The 16 polar sites agree within a few pp. Two exceptions: - **The geographic south pole:** C3 gives 24.7 % (Sun) and 27.3 % (Earth); the map gives 47.1 % and 46.8 %. - **StarHab, Earth:** C3 gives 67.4 %; the map gives 86.6 %. Both sit on steep slopes where a 20 m horizon and a 240 m pixel see different ground. The pole lies on Shackleton's inner rim. These differences show the map's resolution, not a different method. The integration itself is checked at Malapert against `moonat.visibility.visible_fraction` over 3000 random steps: a mean of 75.012 % against 75.012 %, with a largest single-step difference of 0.028. ### 5.4 Published points | Point | Published | Map at the point | Best map pixel within 1 km | |---|---|---|---| | Gläser et al. 2014, connecting ridge spot 1 (2 m, 20 m DTM) | 88.1 % | 80.6 % | **90.1 %** | | Gläser et al. 2014, spot 3 (10 m mast) | 92.5 % | 78.0 % | 90.1 % | | Bussey et al. 2010, Malapert M1 (Kaguya DEM, one year) | 74 % | 40.2 % | **76.2 %** | All values are the mean visible solar disk. These points sit on ridges about 100 m wide or on the summit of a steep massif, where 240 m pixels mix crest and slope. Within 1 km the map reaches the published values. At the exact coordinates it reads lower: Malapert M1 falls on the steep side of the massif in the LOLA frame. Moonat's site-level pipeline (20 m near field) reproduces the published values at the points themselves: 92.7 % against 92.5 % for spot 3 (docs/validation/terrain_illumination.json). The map is for seeing where the good ground is; the site pipeline is for exact numbers at a point. ### 5.5 Mazarico et al. (2011) PSR totals Mazarico et al. (2011) give 16 055 km² (south) and 12 866 km² (north) poleward of 80°, from earlier LOLA maps. The PGDA 201608 LPSR map gives 18 440 km² and 15 722 km² on our pixels (79.9–90°). Ours is **18 250 km²** and **15 467 km²**: within 1–2 % of the newer NASA map, and 14 % and 20 % above the 2011 paper. The same gap shows between NASA's own two releases (docs/validation/map_layers.md). ### 5.6 Global sanity checks - **Sun, within 30° of the equator:** median 49.0 %, 5th–95th percentile 45.6–50.1 %. Flat ground sees the Sun half the time, plus about 0.1 pp for the disk and the horizon dip. Crater walls take a few pp from some pixels. - **Earth:** - Near side (|lat|, |lon| ≤ 60°): 100 % except at the feet of steep walls. The lowest value is 0.03 % at 58.3° N, 59.8° E, where the horizon rises 25° toward the Earth and the Earth stands 15° ± 8° high. - Far side (|lon| ≥ 120°, |lat| ≤ 60°): 0.0 % everywhere. - By area (ground within 80.5° of the equator): the Earth is fully in view all the time on 40.0 % and some of the time on 56.0 %. Geometry alone would give 50 % ± the libration band; the poles and the craters near the limb make up the difference. ## 6. Limits - **Resolution.** 240 m at the poles: sub-pixel ridges and pits are smoothed, so the very best spots read a few pp low and the smallest PSRs (below about 0.1 km²) are missed. 8 px/deg with LDEM_16 (1.9 km) elsewhere: craters smaller than about 5 km are not resolved. At low latitudes this changes the Sun's share by well under 1 pp, except on steep walls. - **North cap terrain** is LDEM_75N_240M. Beyond 75° rays use LDEM_16 at both poles. - **"Never lit"** means no part of the Sun was visible at any 4-hour step of 2026–2044, from 2 m. Glints shorter than the step can be missed. In the convergence tests no pixel changed status between 1-hour and 4-hour steps. - **Eclipses** use Moon-centre geometry (less than 0.01 pp effect). The Earth's atmosphere and oblateness are ignored. "Earth visible" means the Earth's disk is above the horizon, whatever its phase. - No scattered light, no Earthshine and no thermal effects: this is geometry only. ## 7. Web layers (web/data/illum/) See `illum.json` (format `moonat-illum/1`). For each layer (`sun`, `earth`, `night`) there is `_global.png` (equirectangular, 2880 × 1440, column 0 = −180° E, row 0 = +90°) and `_{south,north}.png` (the cap projection of overlays.json, psi_max 10.10454°, 80–90°). The Sun caps are 2560 px (240 m, the same pixel grid as `layers_{south,north}.png`). The Earth and darkness caps are 1280 px (480 m, 2 × 2 means), to keep the data size down. The files are 8-bit palette PNGs: index 0–100 is the value (Sun and Earth: 1 % steps, finer than the ±1 pp validation spread; night: a log scale up to 6798 days), and index 255 is transparent. The palette is the colour ramp, so the images can be drawn as they are. Sizes: Sun 6.2 MB (global 1.4, south 2.2, north 2.6), Earth 1.8 MB, darkness 1.5 MB, **9.45 MB in all**. With every cap at 480 m (`--cap-factors sun=2,earth=2,night=2`) it would be about 5 MB; with every cap at 240 m about 18 MB. The ramps use one hue each with lightness rising with the value (OKLCH): amber for the Sun, blue for the Earth, violet for the night (darker = longer). The legend stops and the full palette are in the manifest. To show these layers the map code needs a generic raster-overlay path: draw the global image in equirectangular and the caps in the existing cap projection, with no decoding needed. ## 8. Open choices 1. Main Sun layer: the mean visible disk fraction (the default here) or NASA's "any part visible" (`sun_any`, also computed; about 1 pp higher at the poles)? 2. Eye height: 2 m (the Moonat convention, the default here) or the surface (PGDA)? The difference is a mean of 0.35 pp and up to 5 pp on rough ground. 3. Period: one nodal cycle from 2026 (the default here). Three cycles in a row agree within 0.6 pp (Sun) and 1 pp (Earth).