技能创建器
skill-creator
创建、改进和评估自定义技能,把专业流程转化为可重复使用的 AI 能力。
ensembles【数据与研究】Run Earth2Studio ensemble forecasts with controlled perturbations, bounded member batching, temporal interpolation, checkpoint restart, and ensemble-aware downstream analysis.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this skill when the task needs multiple prognostic rollouts from one or
more initial conditions, controlled initial-condition perturbations, member-wise
uncertainty, or ensemble verification. The primary entry point is
earth2studio.run.ensemble; it returns the same IO object supplied by the
caller, populated with an explicit ensemble coordinate.
This skill owns:
nensemble, batch_size, device, output shape, and member bookkeeping.It does not replace deterministic model/data setup, the general IO backend catalog, model-package download, or a complete cyclone tracker recipe. Keep those concerns in the caller's model/data/IO skills. Support is not exhaustive: model-specific extras, accelerator support, licenses, and data-source access remain prerequisites for the selected components.
input_coords(), output step, variables, and spatial grid.Zero() only for a deliberately identical control ensemble.nensemble and a GPU-fitting batch_size; do not use the full
ensemble as a batch merely because it is the default.ensemble first, followed by
time, lead_time, and the model output dimensions. See
workflows.python scripts/check_ensemble_config.py --help.import numpy as np
from earth2studio.io import ZarrBackend
from earth2studio.perturbation import SphericalGaussian
from earth2studio.run import ensemble
io = ZarrBackend(
"forecast.zarr",
chunks={"ensemble": 1, "time": 1, "lead_time": 1},
backend_kwargs={"overwrite": True},
)
result = ensemble(
time=["2024-01-01"],
nsteps=10,
nensemble=8,
prognostic=model,
data=data_source,
io=io,
perturbation=SphericalGaussian(noise_amplitude=0.15),
batch_size=2,
output_coords={"variable": np.array(["t2m", "tcwv"])},
device=device,
)
nsteps=10 produces nsteps + 1 lead-time slices, including the initial
slice. batch_size=2 still writes all eight members with member coordinates
0..7; it only limits concurrent model state. output_coords is a coordinate
selection, not a perturbation selection.
Gaussian for independent unstructured noise,
SphericalGaussian for a spatially correlated spherical field, or a custom
wrapper for variable-specific amplitudes. Set batch_size to the largest
value that fits the model and perturbation working set.LaggedEnsemble only when the source can fetch
each lag and len(lags) == nensemble. Negative lags are appropriate for
forecasting; positive lags are for hindcast-like use, not future prediction.InterpModAFNO) as prognostic. The
ensemble workflow detects its interp_method while fetching initial data;
do not manually resize the initial tensor.batch_size small,
write one store per checkpoint when needed, then combine outputs only after
checking member coordinate semantics. The HENS perturbation needs model/data
warmup and spherical-grid assumptions; it is not a generic noise shortcut.batch_size=nensemble unless the state is
known to fit. For AsyncZarrBackend, ensemble and lead_time must be in
parallel_coords because built-in ensemble writes partial slices on both
axes; call close() for non-blocking writes. See the synthetic check and
recovery notes in troubleshooting.The built-in workflow writes one array per selected variable. The normal array
layout is [ensemble, time, lead_time, ...model output dimensions...]; the
coordinate dictionary is the authority when a model has extra dimensions.
Check array.shape[0] == nensemble and array.shape[2] == nsteps + 1 for a
single start time before analysis. A subset output_coords can remove
variables or spatial points, so validate against the requested subset rather
than the full model grid.
For member summaries, apply a statistic to tensors with an ensemble coordinate
and reduce that named dimension, for example
earth2studio.statistics.mean(["ensemble"]) or
earth2studio.statistics.std(["ensemble"]). Use crps, energy_score,
brier_score, or rank_histogram only with their metric contracts: the
observation tensor must not contain ensemble, and expensive full-field energy
scores should be avoided unless memory is budgeted. For a diagnostic model,
map each forecast tensor to diagnostic.input_coords() and call the diagnostic
on the member-batched tensor in a custom loop; run.diagnostic itself is not an
ensemble runner. Concrete patterns are in workflows.
Before accepting a run, confirm:
nsteps + 1 lead times and finite values;Use API reference for exact signatures and troubleshooting for predictable failures.
scripts/check_ensemble_config.py performs only local arithmetic and
compatibility checks; it never downloads data, models, or credentials.