Earth Data School/Run real-data code on virtual data
Lesson 1.3 · 4 of 18

Run real-data code on virtual data

The catch with real NASA data is access — logins, S3, huge Zarr stores. So we faked the storage layer, not the science: a virtual S3 + virtual Zarr in your browser serves small, realistic, planted-signal datasets. You write the SAME code you'd write for real, and it just runs.

Earlier lessons ran the method on toy arrays. This one runs the real access idiomsxr.open_zarr(...), earthaccess.login()/search_data()/open(), even s3:// URLs — except they resolve to synthetic data generated in your browser. The code is identical to what you'd run against the real archive; only the bytes are fake (and clearly labelled).

Why this is the right kind of fakeWe didn't simplify the code (that would teach you the wrong thing). We simulated the storage: a virtual Zarr store (a real Zarr, backed by an in-browser dict) and a virtual S3 / earthaccess shim. So the muscle memory you build here is the real muscle memory — swap the shim for a real login and the same code hits NASA.

1 · Virtual Zarr — open a "cloud" store

import earthschool installs the shims; then an ordinary open_zarr on an s3:// URL returns a synthetic dataset shaped exactly like real GPM IMERG:

editable · runs in your browser

2 · The full earthaccess idiom → a verified trend

The login → search → open flow you'd write for real, then the unchanged area-weighted Theil–Sen trend — and it recovers the planted truth:

editable · runs in your browser

What's wired

Every dataset in the catalog — ~3,400 of them — is wired. Pass any short_name to earthschool.dataset("…") (or any s3://…/<short_name>.zarr) and you get a synthetic dataset with a plausible variable, units, seasonality and planted trend inferred from that dataset's catalog metadata. The most-taught products — GPM IMERG, MODIS NDVI & LST, SMAP, GRACE, Black Marble, OCO-2, TROPOMI, ERA5 — have hand-tuned specs; the rest are inferred by theme + keywords (so the shape is right even if the exact behaviour is approximate). Everything is synthetic and labelled NOT real measurements — for learning the workflow, then pointing the identical code at the real archive.

editable · runs in your browser
The honest boundarySynthetic ≠ real: the shapes, units and idioms are faithful, but the values are invented (with a known signal so you can self-check). Use this to learn and debug the workflow; trust only real data for real answers — and then cross-check it.