commands

couple

class anemoi.inference.commands.couple.CoupleCmd

Bases: Command

Couple tasks based on a configuration file.

add_arguments(command_parser: ArgumentParser) None

Add arguments to the command parser.

Parameters:

command_parser (ArgumentParser) – The argument parser to which the arguments will be added.

run(args: Namespace) None

Run the couple command.

Parameters:

args (Namespace) – The arguments passed to the command.

anemoi.inference.commands.couple.command

alias of CoupleCmd

inspect

class anemoi.inference.commands.inspect.InspectCmd

Bases: Command

Inspect the contents of a checkpoint file.

add_arguments(command_parser: ArgumentParser) None

Add arguments to the command parser.

Parameters:

command_parser (ArgumentParser) – The argument parser to which the arguments will be added.

run(args: Namespace) None

Run the inspect command.

Parameters:

args (Namespace) – The arguments passed to the command.

dump(metadata: Metadata, args: Namespace) None
variables(metadata: Metadata, args: Namespace) None

Print the variable categories in the checkpoint.

indices(metadata: Metadata, args: Namespace) None

Print the variable indices in the checkpoint.

datasets(metadata: Metadata, args: Namespace) None

Print the dataset arguments and keyword arguments for opening datasets.

requirements(checkpoint: Checkpoint, args: Namespace) None

Print the requirements for the checkpoint, including PyPI and Git dependencies.

anemoi.inference.commands.inspect.command

alias of InspectCmd

metadata

patch

anemoi.inference.commands.patch.diff(old, new, *path)
class anemoi.inference.commands.patch.PatchCmd

Bases: Command

Patch a checkpoint file with new dataset metadata from the original training dataset. If the checkpoint’s metadata is already up to date, this command does nothing. Otherwise, it updates the metadata and supporting arrays in-place.

add_arguments(command_parser: ArgumentParser) None
run(args: Namespace) None

Run the patch command.

anemoi.inference.commands.patch.command

alias of PatchCmd

requests

class anemoi.inference.commands.requests.RequestCmd

Bases: Command

MARS request utility.

add_arguments(command_parser: ArgumentParser) None

Add arguments to the command parser.

Parameters:

command_parser (ArgumentParser) – The argument parser to which the arguments will be added.

run(args: Namespace) None

Run the request command.

Parameters:

args (Namespace) – The arguments passed to the command.

anemoi.inference.commands.requests.command

alias of RequestCmd

retrieve

anemoi.inference.commands.retrieve.print_request(verb, request, file=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>)
anemoi.inference.commands.retrieve.checkpoint_to_requests(checkpoint: Checkpoint, *, dataset_name: str, date: str | datetime | int, staging_dates: str | None = None, forecast_dates: bool = False, use_grib_paramid: bool = False, dont_fail_for_missing_paramid: bool = False, extra: list[str] | None = None, patch_request: Callable[[dict[str, Any]], dict[str, Any]] | None = None, use_scda: bool = False, include: list[str] | None = None, exclude: list[str] | None = None, lead_time: Any | None = None, time_step: Any | None = None) list[dict[str, Any]]

Convert a checkpoint to a list of data requests.

Parameters:
  • checkpoint (Checkpoint) – The checkpoint object containing the necessary data.

  • dataset_name (str) – The name of the dataset to prepare requests for (used for multi-dataset checkpoints).

  • date (Date) – The date for the data request.

  • staging_dates (str, optional) – Path to a file with staging dates.

  • forecast_dates (bool, optional) – Whether to use forecast dates (for forcings).

  • use_grib_paramid (bool, optional) – Whether to use GRIB parameter IDs.

  • dont_fail_for_missing_paramid (bool, optional) – Whether to ignore missing parameter IDs.

  • extra (list of str, optional) – Additional request values.

  • patch_request (Callable[[DataRequest], DataRequest], optional) – Function to patch the data request.

  • use_scda (bool, optional) – Whether to use SCDA stream for 6/18 input time.

  • include (Optional[List[str]]) – Categories to include.

  • exclude (Optional[List[str]]) – Categories to exclude.

  • lead_time (Optional[Any]) – The lead time for the data request (used with forecast_dates).

  • time_step (Optional[Any]) – The time step for the data request (used with forecast_dates).

Returns:

A list of data requests.

Return type:

List[DataRequest]

anemoi.inference.commands.retrieve.comma_separated_list(value)
class anemoi.inference.commands.retrieve.RetrieveCmd

Bases: Command

Used by prepml.

add_arguments(command_parser: ArgumentParser) None

Add arguments to the command parser.

Parameters:

command_parser (ArgumentParser) – The argument parser to which the arguments will be added.

run(args: Namespace) None

Run the retrieve command.

Parameters:

args (Namespace) – The arguments passed to the command.

anemoi.inference.commands.retrieve.command

alias of RetrieveCmd

run

class anemoi.inference.commands.run.RunCmd

Bases: Command

Run inference from a config yaml file.

add_arguments(command_parser: ArgumentParser) None

Add arguments to the command parser.

Parameters:

command_parser (ArgumentParser) – The argument parser to which the arguments will be added.

run(args: Namespace) None

Run the inference command.

Parameters:

args (Namespace) – The arguments passed to the command.

anemoi.inference.commands.run.command

alias of RunCmd

sanitise

class anemoi.inference.commands.sanitise.SanitiseCmd

Bases: Command

Sanitise a checkpoint file.

add_arguments(command_parser: ArgumentParser) None

Add arguments to the command parser.

Parameters:

command_parser (ArgumentParser) – The argument parser to which the arguments will be added.

run(args: Namespace) None

Run the sanitise command.

Parameters:

args (Namespace) – The arguments passed to the command.

anemoi.inference.commands.sanitise.command

alias of SanitiseCmd

validate

class anemoi.inference.commands.validate.ValidateCmd

Bases: Command

Validate the virtual environment against a checkpoint file.

add_arguments(command_parser: ArgumentParser) None

Add arguments to the command parser.

Parameters:

command_parser (ArgumentParser) – The argument parser to which the arguments will be added.

run(args: Namespace) bool

Run the validation command.

Parameters:

args (Namespace) – The arguments passed to the command.

Returns:

True if the environment is valid, False otherwise.

Return type:

bool

anemoi.inference.commands.validate.command

alias of ValidateCmd