# EarthLens An interactive view of how the Earth shifts, dries and changes over time, driven by dials you turn. The main dial sweeps the whole span: the Hadean, Archean, Proterozoic and Phanerozoic, the present day, and on into futures millions to a billion years ahead. Four more dials push the planet one way or the other, so the deep future branches rather than being fixed — it can end as a dried-out, dead rock, or as a greened-up, flourishing world, depending on where you leave them. ## Opening it Double-click `index.html`. That is all of it: one self-contained file, no server, no build step, no dependencies, no network access. Every era is drawn pixel by pixel into a `` from the model. The one exception is the present day, which is a photograph — see below. The globe is built in two stages. Whenever the model changes, an equirectangular set of maps — surface colour, slope, glossiness — is baked from the model and some fractal noise. Every frame then projects a sphere and samples them, which leaves enough budget to light it properly: the slope map tilts the surface normal so that mountains and sea-floor ridges catch the sun and fall dark at the terminator instead of being painted on, water and ice take a specular glint, and the air hazes and reddens towards the limb. **Clouds are not drawn**, so the land is never hidden — they are still in the energy balance, where they supply most of the planet's albedo, but the point of the picture is the land, and weather was covering it. **The sea floor is part of it.** Under the water there is a shelf, a continental slope, an abyssal plain and a mid-ocean ridge system, and the water above is treated as water: each colour is attenuated over the depth it has to travel through, red first. So a shelf shows its sand as turquoise, a ridge crest reads as a paler blue rise, and an abyssal plain shows nothing but ocean — and all of it is lit, so the shape of a basin is visible as relief rather than as a colour ramp. The full maps are too large to bake in one go, so they go on in passes of rising resolution, each cut into slices short enough that the page stays responsive — nothing blocks the main thread for more than about 15 ms, measured. Moving a dial gets a coarse bake at once; the first picture is up about 25 ms after load, and the detail arrives over the next second or two, the way a progressive image sharpens. Works in any current browser. On Windows: ```bash start index.html ``` ## The dials | Dial | Range | What it does | |---|---|---| | **Time** | 4.54 Ga ago → +1 Ga | The whole span. Continents drift and gather into supercontinents, oceans appear and spread, ice advances and retreats, land goes green or goes bare. | | **CO₂** | ×0.05 – ×50 | Multiplies the natural CO₂ of whatever moment you are at. Drives the greenhouse, and in the deep future decides whether plants starve. | | **Sun** | ×0.70 – ×1.30 | Multiplies the standard solar model. Above 1 is a brighter star than physics gives you; **below 1 means a shade** — a built one. See the note below. | | **Water** | ×0 – ×1.6 | Ocean volume. At 0 the basins are bare rock; above 1 the shelves flood. | | **Biosphere** | ×0 – ×1.6 | How well life is doing against the record: vegetation cover, the methane an anoxic biosphere sustains, the oxygen production that follows. | Drag a dial round, or focus it and use the arrow keys (hold shift for fine steps, Home/End for the limits), or scroll on it. There is a timeline scrubber under the globe with ticks for the events worth finding, and **Jump to** buttons for the famous moments and for both endings. With nothing in particular focused, the page itself takes `←` and `→` to step through time (shift for fine steps), `space` to start and stop the sweep, and `s` to stop the spin. A control that has the focus keeps its own keys. The globe stays in sight while you work the dials: on a window tall enough to hold it the panel sticks as you scroll, and on a phone — or a short window — a small live copy of the planet appears in the corner once the real one has scrolled away. Tap it to go back up. The readouts beside the dials give global mean temperature, sea level, CO₂ and O₂, ice cover, land vegetation, ocean coverage, solar luminosity and a biosphere index, plus a plain-language line naming the era and saying what the planet looks like at that setting. ## Linking to a moment Every dial position is in the address bar, so a setting worth finding is a setting you can keep: index.html#age=252&co2=2 `age` is in millions of years before the present, the same convention the console uses — positive is past, negative is future. Only the dials that differ from their natural value are written, so most moments are a short link. **copy link**, under the globe, puts the current one on the clipboard. Anything the link leaves out is at its natural value, so the same link always gives the same planet. It is a hash rather than a query because the page has to work opened from disk, with no server to ask. A browser that refuses to rewrite a `file://` URL quietly stops following the dials, and the copy-link button still works. ## The two endings Leave the four modifier dials alone and run time forward and you get the one the physics gives you. The Sun brightens about 10% per billion years; silicate weathering speeds up and draws CO₂ down; somewhere around +500 to +800 Myr CO₂ falls below what C3 plants can fix and the land biosphere goes; the planet passes a moist greenhouse, loses its surface water to hydrogen escape, and with no water there is no weathering, so volcanic CO₂ simply accumulates. **Dry death**: a hot, CO₂-thick rock around 28 °C with no ocean and nothing alive. The other ending needs intervention, and the app does not pretend otherwise. Dim the Sun to about ×0.92 (a starshade), hold CO₂ up around ×25 against the weathering drawdown, keep the water, and let the biosphere run a little above the record: **flourishing**, a watered, temperate, 16 °C Earth a billion years from now with vegetation over most of its land. The preset buttons set both. Between them there is a wide band the app calls an undecided future, which is the honest answer for most dial settings. ## How much of this is real The shape of the curves is taken from the record; the exact numbers are hand-fitted approximations. `SOURCES.md` lists what each one rests on and, more importantly, the places where the model is knowingly wrong. The short version: - **Honest.** The Great Oxidation Event and the Huronian glaciations it triggers, the Cryogenian snowballs and their CO₂-spike exits, the Cambrian explosion, the big extinctions, the Carboniferous oxygen peak and ice age, the Cretaceous hothouse, the last glacial maximum, the Sun's slow brightening, CO₂ starvation and the eventual loss of surface water. Present day comes out at 14.8 °C, 29.1% land, 10% ice and sea level within a few metres of zero; the last glacial maximum comes out 5.3 K colder than today. That is the calibration working. (Land and temperature both moved a little closer to the real values when the reconstruction replaced the model's blobs — 29.1% against Earth's 29.2%, where the blobs gave 30.3%.) - **Approximate.** Deep-time CO₂ is order-of-magnitude. Climate sensitivity lands near 4 K per CO₂ doubling, the upper half of the accepted range. The Hadean and Archean come out warm. - **The continents are real, for the last billion years.** From 0 to 1000 Ma they come from Merdith et al. (2021) — a published full-plate reconstruction, fetched once from the GPlates Web Service and rasterised to 27 time slices that the app interpolates between. Pangaea is Pangaea. The supercontinent cycle is not asserted anywhere in the code; it falls out of the data, which puts 97% of land in one mass at 160 Ma and 21% at 620 Ma. - **Before a billion years ago, nobody knows**, so the app stops pretending to: Rodinia is argued over and anything earlier is speculation. Past 1000 Ma the continents become the model's own ten cratonic blocks following the supercontinent cycle, and the caption says which you are looking at. (This replaces an earlier decision to keep the whole span procedural. It was the right call while there was no data in the app; it stopped being right once there was.) - **Decoration.** Mountains, coastline crenellation, the sea floor, islands, lakes and individual lakes are fractal noise, not data. What the model does set is how much of each there is: biome colour follows the model's own zonal temperature, the sea greens only where there is a biosphere to green it, and ice cover in the picture is the same number the readout gives. Islands and lakes are in the picture only — both sit below what the block geometry resolves, so the land and ocean percentages ignore them. - **Measured colour.** The palette is not invented — ocean, forest, tundra, savannah, desert, rock and ice were sampled off NASA's Blue Marble composite and the model's colours set to match. `SOURCES.md` has the numbers. - **The present day is a photograph.** Within about a million years of now, and only while the dials are left alone, the land and sea are NASA's Blue Marble itself (public domain, embedded, 1024×512) — so "now" is the Earth you recognise rather than a plausible planet. The ice, the weather, the light and the air stay the model's, so the dials keep working: move any of them and the model takes the surface back within a few steps. By 12 Ma the photograph is gone entirely. - **Invented history: none.** Where a number is a guess, `SOURCES.md` says so. ## Files index.html the whole app — markup, CSS, model and renderer README.md this SOURCES.md where the numbers come from, and where the model cheats manifest.webmanifest what the phone needs to install it sw.js the service worker, so an installed copy runs offline icon-*.png the app icons, drawn from the app's own Earth ops/earthlens-backup the VPS's nightly snapshot job (not part of the app) ops/make_icons.py redraws the icons (run by hand, not at build time) ## Installing it on a phone Open `https://apps.theinvestorsnest.com/earthlens/` in Chrome on Android. An **install** button appears under the globe, beside *copy link*; the browser's own menu has **Install app** as well. Either lands it on the home screen with its own icon, opening without browser chrome. The button is only there when the browser has offered it — it appears on the `beforeinstallprompt` event and nowhere else, so an already-installed copy, iOS and Firefox simply don't show it. On an iPhone it is Share → **Add to Home Screen**; iOS gives no install prompt and no offline cache, but the icon and the full-screen opening work. An installed copy **works with no signal**. The app is a single file and a few icons, so the service worker keeps the whole thing — about 300 KB — and serves it from there first, checking for a new version in the background. So the copy you are looking at is always the one before the most recent deploy. That used to be silent, and read as a deploy that had failed. Now, when the background check finds a genuinely different build — compared on the ETag the server sends, not on the 250 KB of HTML — the worker tells the open page and a **newer version — reload** button appears beside the others. It is never automatic: a reload while someone is mid-dial is worse than a page a few minutes old. The dial positions are written to the URL before the reload, so you come back to the same planet. None of this touches the copy on disk. `index.html` opened by double-clicking registers no worker and asks for no manifest; it is still the self-contained file it always was. The icons are the app's own Earth — `ops/make_icons.py` takes the Blue Marble texture out of `index.html`, projects it onto a sphere and lights it the way the renderer does. Run it only if the look changes; the results are committed. ## Where it lives - **Source:** this folder. `origin` is a private bare repo on the VPS, `ubuntu@apps.theinvestorsnest.com:/srv/git-earthlens/earthlens.git` — pushing there mirrors the history and publishes nothing. - **Published:** `https://apps.theinvestorsnest.com/earthlens/`, served from `/srv/earthlens`. That is a separate, deliberate deploy: copy `index.html`, `README.md` and `SOURCES.md` up and `sudo install` them. Pushing does not touch it. - **Backed up:** `/etc/cron.daily/earthlens-backup` (the copy in `ops/`) writes a tar of the served site and a verified git bundle of the mirror into `/var/backups/earthlens` every night, keeping 14 days of each. Test it without disturbing the day's real snapshot: ```bash sudo env BACKUP_OUT=/tmp/el-backup-test /etc/cron.daily/earthlens-backup ``` ## Poking at it The model is exposed on `window.EarthLens` for the console: ```js EarthLens.modelEarth(252, { co2: 1, solar: 1, water: 1, bio: 1 }) // the end-Permian EarthLens.modelEarth(-1000, { co2: 25, solar: 0.92, water: 1.1, bio: 1.25 }) ``` `age` is in millions of years **before** the present, so positive is past and negative is future. A call costs about 3.5 ms. `renderGlobe`, `quickBake` and `startProgressiveBake` are exposed alongside it if you want to drive the picture yourself.