Anemoi

Contents

Anemoi#

class ufs2arco.targets.Anemoi(source: Source, chunks: dict, store_path: str, rename: dict | None = None, forcings: list | tuple | None = None, statistics_period: dict | None = None, compute_temporal_residual_statistics: bool | None = False, sort_channels_by_levels: bool | None = False, variables_with_nans: list | None = None, transformed_dims: dict | None = None)#

Store dataset ready for anemoi

Expected output has dimensions

("time", "variable", "ensemble", "cell")

Use the rename argument to modify any of these before they get packed in the anemoi dataset. This might be useful if you want to train a model with the same variables, but from different datasets, so they have different names originally.

Assumptions

  • For EnsembleForecastSource and ForecastSource datasets, t0 gets renamed to time, and fhr is silently dropped

  • do_flatten_grid = True

  • resolution = None, I have no idea where this gets set in anemoi-datasets

  • just setting use_level_index = False for now, but eventually it would be nice to use this flag to switch between how vertical level suffixes are labeled

  • if sort_channels_by_level is True, then we’ll make sure that channels go like variable_<level 0> -> variable_<largest level value>

Methods

Anemoi.__init__(source, chunks, store_path)

Anemoi.add_dates()

Deal with the dates issue

Anemoi.aggregate_stats(topo)

Aggregate statistics over "time" and "ensemble" dimension.

Anemoi.apply_transforms_to_sample(xds)

After opening a single dataset for the given initial condition, forecast hour, and member, Apply any transformations necessary for storage

Anemoi.calc_temporal_residual_stats(topo)

Anemoi.compute_forcings(xds)

Anemoi.compute_valid_time(topo)

Deal with the dates issue

Anemoi.finalize(topo)

Finalize the dataset with * dates * stats * temporal stats (if specified)

Anemoi.handle_missing_data(missing_data)

Take a list of dicts, with dimensions of missing data.

Anemoi.manage_coords(xds)

Manage the coordinates that will get stored in the container

Anemoi.merge_multisource(dslist)

Take a list of datasets, each from their own source, and merge them

Anemoi.reconcile_missing_and_nans()

This has to happen after add_dates() is called.

Anemoi.rename_dataset(xds)

In addition to any user specified renamings.

Attributes

Anemoi.allow_nans

Anemoi.always_open_static_vars

Anemoi.dates

Anemoi.datetime

Anemoi.dim_order

Anemoi.do_flatten_grid

Anemoi.end_date

Anemoi.ensemble

Anemoi.expanded_horizontal_dims

Anemoi.fhr

Anemoi.horizontal_dims

Anemoi.member

Anemoi.name

Anemoi.protected_rename

Anemoi.renamed_sample_dims

Anemoi.resolution

Anemoi.sample_dims

Anemoi.start_date

Anemoi.statistics_end_date

Anemoi.statistics_start_date

Anemoi.t0

Anemoi.time

Anemoi.use_level_index