Skip to content

Figures

João Siqueira edited this page Nov 10, 2026 · 3 revisions

The figures in this wiki are generated, not drawn, by docs/figures/build_figures.py. It runs the scripts in codes/ unchanged on four example pixels, so the values shown are the layers the scripts produce.

How it works

  • docs/figures/run_scripts.js runs each script of codes/ unchanged in Node, with a one-pixel stand-in for ee, Map and require, and records the value of every layer passed to Map.addLayer.
  • build_figures.py checks those values against the ones the figure and the text describe (expected in each entry of ANALYSES) and stops if they differ, so the figures cannot drift from the scripts.
  • Each figure is an HTML page rendered to PNG by headless Chrome, in a light and a dark version, saved in docs/figures/.

Rebuilding

From the repository root (needs Node and Google Chrome):

python docs/figures/build_figures.py                  # all figures
python docs/figures/build_figures.py analysis_1_age   # one figure

Adding an analysis

  1. Add the script to codes/ as analysis_N_<name>.js.
  2. Add its entry to ANALYSES in build_figures.py (the build fails while a script has no entry) and run the build.
  3. Add its page to this wiki, with the new figure, its row to the table in the README and its item to the Home list and the sidebar.
  4. Run docs/wiki/update_nav.py on a clone of the wiki: it rewrites the previous/next links at the end of every analysis page, in the order of the README table.

Clone this wiki locally