From b4d72f1d10117de0b050c7a43c8665c53dee289e Mon Sep 17 00:00:00 2001 From: Jesper Dramsch Date: Wed, 11 Sep 2024 17:14:05 +0200 Subject: [PATCH] Fix: make remapper config object optional (#36) * fix: make config object optional * chore: add .envrc to gitignore * docs: changelog --- .gitignore | 1 + CHANGELOG.md | 2 +- src/anemoi/models/data_indices/collection.py | 6 ++++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index d8baf06..d92403b 100644 --- a/.gitignore +++ b/.gitignore @@ -121,6 +121,7 @@ celerybeat.pid # Environments .env +.envrc .venv env/ venv/ diff --git a/CHANGELOG.md b/CHANGELOG.md index 48c52c0..5433ccc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,7 @@ Keep it human-readable, your future self will thank you! ### Added - CI workflow to update the changelog on release - - Remapper: Preprocessor for remapping one variable to multiple ones. Includes changes to the data indices since the remapper changes the number of variables. + - Remapper: Preprocessor for remapping one variable to multiple ones. Includes changes to the data indices since the remapper changes the number of variables. With optional config keywords. ### Changed diff --git a/src/anemoi/models/data_indices/collection.py b/src/anemoi/models/data_indices/collection.py index 0d1031b..266c11a 100644 --- a/src/anemoi/models/data_indices/collection.py +++ b/src/anemoi/models/data_indices/collection.py @@ -30,9 +30,11 @@ def __init__(self, config, name_to_index) -> None: self.diagnostic = ( [] if config.data.diagnostic is None else OmegaConf.to_container(config.data.diagnostic, resolve=True) ) - # config.data.remapped is a list of diccionaries: every remapper is one entry of the list + # config.data.remapped is an optional dictionary with every remapper as one entry self.remapped = ( - dict() if config.data.remapped is None else OmegaConf.to_container(config.data.remapped, resolve=True) + dict() + if config.data.get("remapped") is None + else OmegaConf.to_container(config.data.remapped, resolve=True) ) self.forcing_remapped = self.forcing.copy()