# Setup and local builds

LLMS index: [llms.txt](/docs/llms.txt)

---

## Requirements

- Python ≥ 3.14 with [uv](https://docs.astral.sh/uv/). `uv sync` creates
  `.venv` with NumPy and the `xuepy` wheel. Always run Python as
  `.venv/bin/python`; the Makefile picks it automatically.
- GDAL ≥ 3.8 with the GRIB driver. Needed by `XUE_ENCODER=python`, by the
  satellite fetch stage (`gdalwarp`, `gdal_translate`, `gdalbuildvrt`)
  whichever encoder converts, and by the tests. The native encoder inspects
  inputs through the wheel's own GDAL.
- zstd ≥ 1.5 comes with the standard library (`compression.zstd`); no CLI.
- Node.js ≥ 22.
- A Rust toolchain and `wasm-pack` (the browser decoder, `make wasm`).
- eccodes: `grib_set` repacks ECMWF open data (CCSDS-packed) to
  `grid_simple` at fetch time; `bufr_dump` decodes the tropical cyclone and
  sounding BUFR.
- [om2nc](https://github.com/ringsaturn/om2nc), `ifshres` only: reads
  Open-Meteo's `.om` files and writes the NetCDF series the encoders ingest.
  It is GPL-2.0-only and stays a subprocess: nothing in this tree imports,
  links or vendors it, and no om dependency may enter `pyproject.toml`,
  `Cargo.toml` or `web/`. Install a pinned release (the publish workflow
  checks its sha256) or set `XUE_OM2NC` to the command.
- [jma-radar](https://github.com/ringsaturn/jma-radar), `jma` only:
  `uv pip install git+https://github.com/ringsaturn/jma-radar`, or
  `XUE_JMA_RADAR`.
- Optional dependency groups: `uv sync --group zarr` (tests, reading a
  delta store), `--group satellite` (Dust RGB / DEBRA producers and the FCI
  plugin), `--group cma` (the CMA archive reader), `--group aurora`.
- Credentials: `XUE_CMA_ARCHIVE` plus the `R2_*` pair for `cma`;
  `EUMETSAT_CONSUMER_KEY` / `EUMETSAT_CONSUMER_SECRET` for `meteosat`.
- AWS CLI v2 and `jq` for publishing only.

`make check` verifies versions and commands, and reports which encoder a
build would take. The native encoder from source (`make encoder-rust`)
also needs libclang.

`web/src/wasm/` is generated and gitignored: run `make wasm` before the
frontend typechecks or builds.

## Building a run

```sh
make mvp                  # NOAA GFS (default)
make mvp MODEL=ecmwf      # aifs, ifshres, sflux, hrrr, gefsaero, cmadust, silam, cfs, iconeu, arpege, cmageps likewise
make mvp MODEL=cfs HOURS=240   # CFSv2's full run is 1092 frames; slow
make serve
```

Step by step (`--model` takes any id in [`docs/sources.md`](../sources.md);
`--hours` defaults to the whole published axis):

```sh
.venv/bin/python -m xuebuild fetch --run latest --hours 240
.venv/bin/python -m xuebuild build-bin --model ecmwf --run latest
.venv/bin/python -m xuebuild build-bin --model gfs --run latest --hours 6 --xue           # also the .xue
.venv/bin/python -m xuebuild build-bin --model mrms --run 2026091300 --hours 3            # a past window
.venv/bin/python -m xuebuild build-bin --model mrms --run latest --hours 4 --round now    # one live round
.venv/bin/python -m xuebuild build-bin --model himawari --run latest --hours 6 --round now
```

- `XUE_ENCODER`: `auto` (default; the wheel when installed), `native`
  (fail without it) or `python` (the reference pipeline). Both produce
  identical bytes.
- `--hours` may be any hour on the model's axis.
- `build-bin` (and `showcase build`) writes every bundle
  into the run's shared store `bundles.zarr/` straight from the codes, with
  `--xue` each bundle's `.xue` container beside it from the same codes; the
  reduced tiers (`bundles.half.zarr/`, plus `.quarter` on satellites and the
  0.1° grids) and a first-frame poster. `--skip-variants` turns the tiers
  off. The pressure family gets no poster: contours need exact codes.
- A vector bundle (`wind10m`, `wind850`, `qflux850`, …) is added only when
  its components were fetched; `--force-download` re-fetches.
- Overwriting an existing manifest needs `--force`
  (`make mvp FORCE=--force`).

Raw inputs live in `data/raw/`, published data in `web/public/data/`, the
static build in `dist/`. All of it is gitignored.

## The frontend locally

`npm run dev` serves the shell with Vite. The dev server has no Range
support, so streaming stores are exercised through `npm run build` and
`make serve`. The basemap key is origin-locked to `localhost` (not
`127.0.0.1`): browse `http://localhost:4173` to see real tiles.
