Skip to content

Latest commit

 

History

History
70 lines (55 loc) · 2.85 KB

INFERENCE.md

File metadata and controls

70 lines (55 loc) · 2.85 KB

Inference

python -m waveflow sample runs a released checkpoint with the paper's sampling recipe (conditional flow matching, 50 ODE steps, v-prediction) on zero-valued anchor files, so no hindcast target is needed.

python -m waveflow sample --model hk --timestamps 20211013T00 --members 10
python -m waveflow sample --model global --timestamps 20220924T00 --members 10 --steps 50
Flag Meaning
--model {hk,global} checkpoint and mesh
--timestamps comma-separated valid times, YYYYMMDDTHH
--members / --steps ensemble members (10) / ODE steps (50)
--batch-size override sampling.batch_size (HK 32, global 2)
--split dataset split, default test (2021–2022)
--max-year cap the train split at this year, for cases after 2022
--out run directory, default runs/<model>_<first timestamp>
--era5-dir local NetCDF ERA5 frames instead of WeatherBench2
--ens-members, --ens-init, --ens-lead member-forced IFS ENS emulation
--nproc, --dry-run GPUs, print-only

Forcing

ERA5 comes from WeatherBench2 (anonymous access) and is cached under data/era5/wb2/; --era5-dir accepts your own frames in the same layout and then WeatherBench2 is never contacted. The public WB2 archive ends on 2023-01-10, so later cases need --era5-dir or the forecast path; for dates outside the 2021–2022 test split add --split train --max-year <YYYY>. --ens-members forces each member with a different IFS ENS member from the archived ensemble.

Real-time forecast

python -m waveflow forecast uses the IFS ENS on ECMWF open data (enfo, 0.25°, cycles 00/06/12/18 UTC, steps 0–144 h every 3 h) instead of reanalysis: the newest cycle is fetched, the members averaged, and the checkpoint run at every lead. Each lead writes <out>/lead_<L>h/samples/. GRIB decoding needs the Python bindings of ecCodes: python-eccodes from conda-forge (already in environment.yml) or eccodes from PyPI, which ships eccodeslib.

Output

<out>/samples/sample_<timestamp>_ens<NNN>.npz, with:

Key Content
sample (n_nodes, 4) float32, hs, tp, dm, elev in physical units
timestamp valid time
ensemble_index member index
sampling_steps ODE steps used
rank process rank that wrote the file

Node order matches the mesh coordinate file restored by setup.

Plots

python -m waveflow plot --run runs/hk_20211013T00 --var hs

Three panels — first member, ensemble mean, ensemble spread. Hong Kong is drawn on the mesh and cropped to its bounding box; the global field is interpolated to a 0.25° grid for display. Colour limits use the 99.9th percentile with an overflow arrow.

Peak memory is about 2 GB for Hong Kong and 10 GB for the global model (bf16, one GPU, --batch-size 32 / 2); lower --batch-size first if you run out.