Synthetic datasets
A synthetic dataset is an in-memory synthetic dataset. It builds no Zarr store on
disk and is intended for testing and prototyping training and inference
pipelines. Open one by passing a synthetic dictionary to open_dataset:
from anemoi.datasets import open_dataset
ds = open_dataset(
synthetic={
"geography": {"bbox": [60, -10, 30, 20], "resolution": 0.25},
"dates": {"start": "2020-01-01", "end": "2020-01-31", "frequency": "6h"},
"layout": "gridded",
"variables": [
{"name": "2t", "values": {"constant": 273.15}},
"msl",
"insolation",
],
}
)
The dataset itself is described entirely by the synthetic dictionary, which
accepts the following keys. synthetic is a drop-in replacement for dataset:
the usual transform keywords (select, start, end, rename, …) may
be passed alongside it and apply to the result, just as for any other dataset.
geography(required)The spatial extent. Exactly one of:
{"bbox": [north, west, south, east], "resolution": 0.25}— a regular latitude/longitude mesh.resolutionmay be a scalar or[dlat, dlon].{"named": "o96"}— a named grid resolved throughanemoi.transform.grids.{"icon": {"path": "grid.nc", "refinement_level_c": 7}}— an ICON grid file.{"unstructured": {"latitudes": [...], "longitudes": [...]}}— explicit coordinate arrays (or a path to an.npzfile).
dates(required)The temporal extent, as a dict of
start,endandfrequency— mirroring thedatesblock of a dataset-building recipe.startandendare ISO date/datetime strings;frequencyis an anemoi frequency string such as"6h"or"1d".variables(required)A list whose entries are either a string (the variable name, using the dataset-level default value generator) or a dict with a mandatory
nameand any of these optional keys:values— how the variable’s values are generated (see below). Omit to use the dataset-level default.metadata— a per-variable metadata block, surfaced on the dataset’svariables_metadata.statistics— override the analytic statistics, e.g.{"mean": 0.0, "stdev": 1.0}. Unspecified keys keep their analytic value.tendencies_statistics— override the analytic tendency statistics.
A variable whose name is a computed forcing (
insolation,cos_latitude,sin_julian_day,cos_local_time, …) is generated from the grid and dates through earthkit’s forcings source. It must be given as a string (or a dict without avaluesblock) — it owns its own value generation.layout(required)One of
gridded,tabularortrajectories. Onlygriddedis implemented; the other two raiseNotImplementedError.values(optional)The dataset-level default value generator, used for any variable that does not carry its own
values. A value spec is one of:{"constant": 273.15}— a fixed value (given directly).{"random": {"mean": 0.0, "std": 1.0}}— seeded Gaussian noise, reproducible for a givenseed. Parameters are optional.273.15— a bare scalar, shorthand for{"constant": 273.15}."random"— a bare generator name, using its default parameters.
If
valuesis omitted, every non-forcing variable defaults torandomwith mean 0 and standard deviation 1.ensembles(optional, default1)The number of ensemble members.
seed(optional, default0)Seed for the
randomvalue generator.dtype(optional, defaultfloat32)The dtype of the generated data.
resolution(optional)Overrides the resolution string reported by
ds.resolutionand the dataset metadata. By default it is derived from thegeography— thebboxspacing or thenamedgrid name — and is"unknown"foriconandunstructuredgrids.