Advanced Command line Use

You can run the inference from the command line using the anemoi-inference run command.

You must first create a configuration file in YAML format. The simplest configuration must contain the path to the checkpoint:

checkpoint: inference-anemoi.ckpt

Then you can run the inference with the following command:

anemoi-inference run inference.yaml

The other entries in the configuration file are optional, and will be substituted by the default values if not provided.

You can also override values by providing them on the command line:

anemoi-inference run inference.yaml date=2020-01-01

Overrides are parsed as an OmegaConf dotlist, so list items can be accessed with list.index or list[index].

You can also run entirely from the command line without a config file, by passing all required options as an override:

anemoi-inference run checkpoint=mycheckpoint.ckpt date=2020-01-01

The configuration below shows how to run the inference from the data that was used to train the model, by setting dataset entry to true:

checkpoint: inference-anemoi.ckpt
dataset: true
date: 2021-09-01

Below is an example of how to override list entries and append to lists on the command line by using the dotlist notation. Running inference with following command:

anememoi-inference run lam.yaml \
    "input.dataset.cutout.0.dataset=./analysis_20240131_00.zarr" \
    "input.dataset.cutout.1.dataset=./lbc_20240131_00.zarr"

together with configuration file:

checkpoint: inference-anemoi.ckpt

date: 2024-01-31T00:00:00

input:
  dataset:
    cutout:
      - dataset: ./analysis_20240101_00.zarr

will overide the first entry in the input.dataset.cutout list with the dictionary {"dataset": "./analysis_20240131_00.zarr"} and will append the dictionary {"dataset": "./lbc_20240131_00.zarr"} to it.

The configuration below shows how to provide run the inference for a checkpoint that was trained with one the ICON grid:

checkpoint: icon.ckpt
icon_grid: icon_grid_0026_R03B07_G.nc

env:
  ECCODES_PYTHON_USE_FINDLIBS: 1
  ECCODES_DEFINITION_PATH: definitions.edzw-2.31.0-2

See Run Command for more details on the configuration file.

Warning

This is still work in progress, and content of the YAML configuration files will change and the examples above may not work in the future.

See also