Settings
Anemoi uses pydantic-settings to manage configuration. Every setting can be configured via a TOML/YAML config file or overridden at runtime with an environment variable.
Configuration files
File |
Purpose |
|---|---|
|
Main configuration (non-secret values) |
|
Alternative YAML format for main configuration |
|
Secret values (must be mode |
|
Alternative YAML format for secrets |
Override the file location by setting the ANEMOI_SETTINGS_FILE
environment variable.
Loading priority
Settings are loaded with the following priority (highest first):
Environment variables (
ANEMOI_SETTINGS_*)Secrets file (
settings.secrets.toml/settings.secrets.yaml)Main config file (
settings.toml/settings.yaml)Default values defined in the schema
Environment variables
All settings can be overridden using environment variables. The naming convention is:
ANEMOI_SETTINGS_<SECTION>__<KEY>=<value>
Sections and keys are upper-cased, underscores in field names stay as
single underscores, and nested sections use double underscores
(__) as separators.
Examples
Object storage endpoint
The TOML key endpoint-url in section [object-storage] maps to
field name endpoint_url on ObjectStorageConfig. The environment
variable is built as ANEMOI_SETTINGS_ + OBJECT_STORAGE + __
+ ENDPOINT_URL:
# Set the global S3 endpoint
export ANEMOI_SETTINGS_OBJECT_STORAGE__ENDPOINT_URL="https://s3.example.com"
Object storage credentials (secrets)
Secret fields follow the same naming. The field access_key_id on
ObjectStorageConfig becomes:
# Override the S3 access key at runtime
export ANEMOI_SETTINGS_OBJECT_STORAGE__ACCESS_KEY_ID="AKIA..."
export ANEMOI_SETTINGS_OBJECT_STORAGE__SECRET_ACCESS_KEY="wJalr..."
Note
For persistent secret storage, prefer the settings.secrets.toml
file (mode 0600) over environment variables to avoid secrets
leaking into process listings or shell history.
Dataset search paths
List fields are set as JSON-encoded arrays:
# Add dataset search paths
export ANEMOI_SETTINGS_DATASETS__PATH='["/data/zarr", "s3://bucket/datasets"]'
Boolean flags
# Skip dataset naming convention checks
export ANEMOI_SETTINGS_DATASETS__IGNORE_NAMING_CONVENTIONS="true"
# Use search-path fallback when a .zarr path is not found
export ANEMOI_SETTINGS_DATASETS__USE_SEARCH_PATH_NOT_FOUND="true"
ParamDB settings
# Change the default GRIB parameter origin
export ANEMOI_SETTINGS_PARAMDB__DEFAULT_ORIGIN="ecmf"
# Extend the parameter cache lifetime to 90 days
export ANEMOI_SETTINGS_PARAMDB__CACHE_LENGTH="90"
Utils – custom grids directory
export ANEMOI_SETTINGS_UTILS__GRIDS_PATH="~/my-grids"
Custom settings file location
This is a standalone variable (not part of the nested schema) that controls which configuration file is loaded:
# Load settings from a project-specific file instead of the default
export ANEMOI_SETTINGS_FILE="/project/config/anemoi-settings.toml"
Slurm / batch job usage
Environment variables are particularly useful in batch jobs where you cannot modify config files on shared filesystems:
#!/bin/bash
#SBATCH --job-name=anemoi-train
export ANEMOI_SETTINGS_OBJECT_STORAGE__ENDPOINT_URL="https://s3.internal.hpc"
export ANEMOI_SETTINGS_DATASETS__PATH='["/scratch/datasets"]'
export ANEMOI_SETTINGS_PARAMDB__CACHE_LENGTH="7"
srun python -m anemoi.training ...
Settings schema reference
The reference below is auto-generated from the Pydantic schema.
AnemoiSettings
- pydantic settings anemoi.utils.settings.AnemoiSettings
Settings for Anemoi.
Use the
ANEMOI_SETTINGS_FILEenvironment variable to specify a custom location for the main settings file (default:~/.config/anemoi/settings.toml).The main settings file can be in either TOML or YAML format; the extension is ignored.
SecretStr-typed fields should be placed in a separate secrets file with the same name but suffixed with.secrets(e.g.settings.secrets.toml) and must have permissions set to0600. Non-secret fields will be ignored if found in the secrets file, and secret fields will be rejected if found in the main settings file, to encourage proper separation of concerns.Note: Init kwargs are intentionally disabled as a source of settings.
Settings are loaded with the following priority (highest to lowest):
Environment variables (with prefix
ANEMOI_SETTINGS_and keys in upper case with underscores)Secret values from the
.secrets.(toml|yaml)fileNon-secret values from the
.(toml|yaml)fileDefault values defined in the
AnemoiSettingsclass and its nested models
- Fields:
- field object_storage: ObjectStorageConfig [Optional] (alias 'object-storage')
Configuration for S3-compatible object storage.
- field datasets: DatasetsConfig [Optional]
Dataset discovery and validation settings.
- field paramdb: ParamDBConfig [Optional]
GRIB parameter database lookup settings.
- field registry: RegistryConfig [Optional]
Configuration for access to the Anemoi registry.
- field utils: UtilsConfig [Optional]
Miscellaneous anemoi-utils settings.
Object storage – [object-storage]
- pydantic model anemoi.utils.settings_schema.object_storage.ObjectStorageConfig
Object storage configuration for S3-compatible services.
- Fields:
- field type: str = 's3'
Default storage type (only ‘s3’ is currently supported).
- field endpoint_url: str | None = None (alias 'endpoint-url')
Global endpoint URL (leave empty for default AWS endpoint).
- field access_key_id: SecretStr | None = None (alias 'access-key-id')
Global access key ID.
- field secret_access_key: SecretStr | None = None (alias 'secret-access-key')
Global secret access key.
- pydantic model anemoi.utils.settings_schema.object_storage.ObjectStorageBucketConfig
Per-bucket overrides for object storage configuration.
- Fields:
- field access_key_id: SecretStr | None = None (alias 'access-key-id')
Bucket-specific access key ID.
- field secret_access_key: SecretStr | None = None (alias 'secret-access-key')
Bucket-specific secret access key.
Datasets – [datasets]
- pydantic model anemoi.utils.settings_schema.datasets.DatasetsConfig
Configuration for dataset discovery and validation.
Used by
anemoi-datasetsfor search paths, naming convention checks, and named dataset aliases.- Fields:
- field path: list[str] [Optional]
Search paths: list of directories or S3 prefixes for .zarr dataset lookup.
- field use_search_path_not_found: bool = False (alias 'use-search-path-not-found')
When true, if a .zarr path does not exist, strip to basename and search the paths above instead of failing immediately.
- field ignore_naming_conventions: bool = False (alias 'ignore-naming-conventions')
When true, skip all dataset naming-convention validation during creation.
- field named: DatasetsNamedConfig [Optional]
Map of friendly dataset names to full paths or URLs.
- pydantic model anemoi.utils.settings_schema.datasets.DatasetsNamedConfig
Named dataset mappings (friendly name -> full path/URL).
ParamDB – [paramdb]
- pydantic model anemoi.utils.settings_schema.paramdb.ParamDBConfig
Configuration for the GRIB parameter database lookups.
Used by
anemoi.utils.gribto control how GRIB parameter metadata is resolved (online API vs local cache, default origin for disambiguation, and cache lifetime).- Fields:
- field default_origin: str = 'ecmf' (alias 'default-origin')
Default origin to use when disambiguating parameters with the same shortname.
- field cache_length: int = 30 (alias 'cache-length')
Cache length in days for GRIB parameter lookups.
Utils – [utils]
- pydantic model anemoi.utils.settings_schema.utils.UtilsConfig
Miscellaneous anemoi-utils settings.
Used by
anemoi.utils.gridsfor custom grid file paths.- field grids_path: Path | None = None (alias 'grids-path')
Custom path to a directory containing precomputed grid files (grid-<name>.npz).
When set, grids are loaded from this directory before falling back to the built-in remote source. Supports ~ expansion.
- field cache_directory: Path = PosixPath('/home/docs/.cache/anemoi') (alias 'cache-directory')
Custom path to a directory for caching downloaded files (e.g. grid files or grib param).
- field debug_imports_in_cli: bool = False (alias 'debug-imports-in-cli')
Whether to print debug information about imports in the CLI.