Architecture overview

This page describes how Met.3D is put together as a whole: which objects exist, how they relate to each other, and which design decisions shape the result. It is the recommended entry point before diving into Implementation details.

The reasoning behind them (which requirements they follow from, which alternatives were rejected, and what is still missing) is outlined in Design rationale.

The architecture goes back to the design presented in Chapter 5.3 of Marc Rautenhaus’ PhD thesis (Rautenhaus, 2015). Most of the core concepts are still in place. This page describes the current state of the code.

Design goals

Met.3D was designed around four goals that still explain most of the architectural decisions:

Interactive response times on commodity hardware.

The system targets standard commodity hardware with monocular displays — regular desktop computers and notebooks with a multi-core CPU and an OpenGL 4.3 capable GPU. Two mechanisms carry most of the weight in reaching interactive response times: the visualization algorithms are GPU-based and operate directly on the forecast data, fusing the mapping and rendering stages, and everything that has been computed once is cached by the memory manager. Pipeline algorithms may run on either the CPU or the GPU.

The forecast dimensions are first-class citizens.

Ensemble member, forecast valid time and forecast initialisation time are not an afterthought bolted onto a scalar-field pipeline. They are part of every data request, which is what allows an actor to ask for “the ensemble mean of wind speed at this valid time” as a single operation.

Native data, no preprocessing step.

Data is read in the form in which it arrives (CF-NetCDF, GRIB, and by now also GeoTIFF and radar formats), rather than being converted into an optimised internal on-disk representation first. This keeps the delay between “data has arrived” and “data is on screen” minimal, at the cost of doing more work at runtime. Systems such as Vapor take the opposite trade-off.

Extensibility as a research framework.

New visualization techniques should be implementable as self-contained actors, and new data processing steps as self-contained pipeline modules, without touching the rest of the system.

From data on disk to pixels

Met.3D follows the classical visualization pipeline model, split into two halves:

  • The data processing pipeline covers the data acquisition and filtering stages. It reads data from disk and derives, filters, regrids and aggregates it. Its output is a data item, typically a 3-D grid for one variable, one ensemble member and one time step.

  • The actors cover the mapping and rendering stages. They turn data items into geometry and pixels.

Conceptually the pipeline could also perform the mapping stage. In practice the GPU-based visualization algorithms operate directly on the forecast data, so mapping and rendering are fused: an isosurface is not extracted into a triangle mesh by the pipeline and then rendered, it is raycast straight out of the 3-D texture holding the data field. See Sampling NWP grids on the GPU for how that works.

Illustration of the Met.3D system design.

Fig. 43 Illustration of the Met.3D system design. Actors consist of a CPU and a GPU part and are connected to one or several data processing pipelines. Requests for data fields are sent asynchronously into the connected pipeline(s). The GPU part of an actor implements its visualization technique and renders the actor into the scene. User interface elements are provided as properties in a property tree. Figure from Rautenhaus (2015), Fig. 5.12; the screenshot shows a historic version of the user interface.

An actor can be connected to one or several pipelines, and each pipeline serves one or several datasets on disk (a dataset typically being all forecasts of one model on a fixed grid topology). When an actor needs a new data item — because the user changed a property, stepped the time, or selected another ensemble member — it sends a request into the corresponding pipeline. The request is asynchronous: the actor does not block, it is notified when the item is available. The main thread therefore stays responsive while data is being read and processed.

Core objects

Object

Purpose

Notes

Data item

MAbstractDataItem

The data entity in Met.3D, for example the 3-D grid of one variable of one ensemble member at one time step, or a set of trajectories.

Knows how to upload itself to GPU memory. See Data items and Grid types.

Data source

MAbstractDataSource

A pipeline module that produces one data item, either by reading it from disk or by processing the items of its input sources.

Provides requestData() / getData(), builds task graphs, and implements a thread-safe produceData(). See Data sources.

Data request

MDataRequest

A unique reference to a data item, containing everything a data source needs in order to produce it.

A sorted KEY=value; string, used directly as the cache key. See Data requests.

Actor

MActor

A visual entity in the scene: a section, an isosurface, a colour bar, trajectories.

Communicates with data sources through asynchronous requests, owns its OpenGL resources and its property subtree. See Actors.

Task

MTask

A container containing information about a request emitted from a data source, i.e. one unit of work. Connected tasks form a directed acyclic task graph.

Can be flagged as a GPU or disk-reader task so that the scheduler can throttle it. See Scheduling in Met.3D.

Memory manager

MAbstractMemoryManager

Caches data items in system memory, keyed by data source and request.

Met.3D runs three independent LRU managers: NWP, Analysis and Trajectories. See Memory management.

Data lease

MDataLease

An RAII handle that pins a cached item for as long as the handle lives.

See Memory management.

Scheduler

MScheduler

Schedules a task graph for execution, respecting dependencies and resource limits.

Singleton; configurable with --threads. See Scheduling in Met.3D.

GL resources manager

MGLResourcesManager

Owns and shares GPU-side resources (textures, shader programs, buffers) across actors and OpenGL contexts.

The GPU-side counterpart of the memory manager. See OpenGL Resource management.

Property

MProperty

One user-editable setting in the tree-structured property panel.

Independent of any UI representation, and able to save and load itself. See Property Framework.

Scene / view

MSceneControl / MSceneViewGLWidget

A scene is a collection of actors; a view renders one scene into a viewport with its own camera.

See Scenes, views and actors below.

Synchronization control

MSyncedControl

Keeps valid time, initialisation time and ensemble member consistent across all actors and properties attached to it.

See Synchronization.

Scenes, views and actors

Actors are not owned by a viewport. The organisation is:

  • An actor is a visual entity. Several instances of the same actor type may exist at the same time — for example two horizontal sections at different pressure levels.

  • A scene (MSceneControl) is a collection of actors. One actor may be part of several scenes at once. If it is modified, for example if a section is relocated, the change is immediately reflected everywhere the actor appears.

  • A view (MSceneViewGLWidget) renders one scene through its own camera, with its own vertical scaling and its own render settings. Several views can be open at the same time and can be added at runtime.

This separation is what enables side-by-side comparison, which is one of the central use cases in forecasting: the same cross-section can be shown as a traditional flat 2-D map in one view and embedded in a 3-D context in another, or two scenes showing different ensemble members can be placed next to each other with their cameras synchronized.

Actors expose their settings as properties in a tree. An actor configuration can be saved to file and restored later, which turns a configured actor into a reusable “forecast product”.

The pipeline is not exposed to the user

This is a deliberate design decision and a difference to general-purpose visualization tools such as ParaView or OpenDX, where the user assembles the pipeline. In Met.3D, a data processing pipeline is preconfigured for each dataset at startup (see Configuration and Variable pipeline) and exposed to the user as a single entry in the data source selector. The user selects a variable, a level type, a time and an ensemble member; everything between the file on disk and the data item is a developer concern.

The upside is that a meteorologist never has to think in pipeline modules. The downside is that adding a processing step means writing a data source and wiring it into pipelineconfiguration.cpp, rather than clicking it together.

Requests become task graphs

A request does not execute anything directly. The data source expands it into a task graph — one task per data source and request, with the dependencies between them — and hands that graph to the scheduler.

The reason is that a single user-level request usually expands into many independent data items: one per ensemble member, per time step, per variable. The graph makes that fan-out explicit, so the scheduler can run the independent parts concurrently even though the pipeline itself is a straight chain.

Where that argument comes from is developed in Design rationale; how a graph is executed is described in Scheduling in Met.3D; and When one request fans out walks through a concrete one.

Where to go next