curriculum · deep dive into wrf · course 1 of 6 · ~13 min

The WRF Toolchain

Five programs, one forecast: geogrid, ungrib, metgrid, real, and wrf, and the files they hand each other.

What “running WRF” actually means

The intro arc ended with a diagram: GFS → WPS → WRF → the map. This arc opens the boxes. And the first thing to know is that WRF is not one program. It is a small assembly line of them, each with one job, each reading the last one’s output from disk and writing its own. When frothy kicks off a forecast at 4 AM, what actually happens is five executables running in sequence, and every one of them can be inspected, re-run, and blamed individually. That separability is the toolchain’s best feature: when a forecast is wrong in an interesting way, you can usually find which handoff went wrong.

reads: global terrain, land-use, soil datasetsreads: parent-model GRIB (GFS / HRRR)geogridWPS · once per regionungribWPS · every rungeo_em.d01…d03UNGRIB:<date>metgridWPS · every runmet_em.d0*realWRF · every runwrfinput_d0*wrfbdy_d01wrfWRF · the forecastwrfout / wrfwind
wrf — The model itself: integrates all domains forward, nests feeding nests, writing history files as it goes. Everything else in the toolchain exists to hand this program a defensible starting point.
The whole system, in the order it runs. WPS (the preprocessor) builds the world and regrids the parent model; real turns that into initial and boundary conditions; wrf does the forecasting. The file names on the arrows are what you actually find on disk mid-run.

Two packages, one seam

The programs come in two separately-distributed packages. WPS, the WRF Preprocessing System, holds geogrid, ungrib, and metgrid; the WRF package proper holds real and wrf. The seam between them is the met_em files, and it is a genuine interface: you can swap the parent model (frothy runs both GFS-fed and HRRR-fed configurations), regenerate the WPS side, and the WRF side neither knows nor cares, so long as the fields it needs show up.

  • geogrid builds the world: terrain height, land use, soil type, land–water masks for every domain. It runs when you design a region, and its geo_em files are then reused, unchanged, by every forecast. Course 2 of this arc lives here.
  • ungrib is a decoder. National centers publish in GRIB, a dense binary format with a table-driven vocabulary; ungrib extracts the fields you asked for into a simple intermediate format. It has no idea your domains exist.
  • metgrid lays the parent model’s fields onto your grids, horizontally. After metgrid, every domain has the parent’s weather at its own points, but still on the parent’s vertical levels.
  • real finishes the move: it interpolates onto WRF’s own terrain-following levels and writes the two files a forecast starts from: wrfinput (the atmosphere at hour zero, one per domain) and wrfbdy (the future arriving at the outer domain’s walls, course 3’s whole subject).
  • wrf is the model: the dynamical core (course 4) and the physics (course 5), integrating every domain forward and writing history files on whatever schedule you demanded.

(Why “real”? Because the alternative is ideal.exe: WRF can also run idealized cases — a lone thunderstorm in a horizontally uniform atmosphere, a two-dimensional hill in a wind tunnel — and researchers use those constantly. The name is a fossil of WRF’s dual life as a research tool.)

Two namelists, one honest annoyance

Each package reads its own configuration file: WPS reads namelist.wps, real and wrf read namelist.input. Both are Fortran namelists: plain text, grouped into sections like &domains and &physics, with values listed per-domain across each line. The two files overlap: domain sizes, nesting ratios, and start positions must be stated in both, and must agree exactly. Every WRF operator has lost an afternoon to an e_we edited in one file and not the other. frothy generates both files from one source (the admin tool you met in the intro arc) precisely so they cannot drift apart; if you build your own setup, steal that idea.

The namelist is also where this arc gets its teaching method. Nearly every concept in the next five courses is pinned to a real line from frothy’s running configuration, shown in excerpts you can poke at. By the end, namelist.input should read less like an incantation and more like a list of decisions someone made on purpose.

The rhythm of a run

Here is the toolchain with timestamps, as frothy runs it four times a day. The parent model’s cycle finishes and its files hit the public feed (the six-hour relay from the intro arc’s course 4). Fetch the GRIB: seconds to minutes. ungrib, metgrid, real: a couple of minutes, mostly I/O. Then wrf runs for the better part of an hour, and it is not close — the model is effectively the entire compute bill, and the inner nest’s tiny timesteps are most of that (the CFL arithmetic from the intro arc, now with invoices). Everything before it exists to hand that hour a defensible starting point; everything after it (extraction, the map, scoring on bench) consumes its output.

One more habit worth forming now: the logs are part of the toolchain. Each stage writes its complaints to well-known places — wrf in particular writes rsl.out and rsl.error files, one per processor — and course 6 is largely about reading them. A pipeline you can’t interrogate is a pipeline you can’t trust.

What to keep

  • WRF is five programs in sequence: geogrid, ungrib, metgrid (WPS), then real and wrf. Each handoff is a file you can inspect.
  • geogrid runs once per region; everything else runs every forecast.
  • met_em files are the seam: swap the parent model on one side, the model on the other side doesn’t care.
  • namelist.wps and namelist.input must agree where they overlap; generate them from one source.
  • wrf.exe is nearly the whole compute cost. The rest is bookkeeping — essential, cheap bookkeeping.