Skip to content

Commit

Permalink
Fix: make remapper config object optional (#36)
Browse files Browse the repository at this point in the history
* fix: make config object optional

* chore: add .envrc to gitignore

* docs: changelog
  • Loading branch information
JesperDramsch authored Sep 11, 2024
1 parent 79fd11a commit b4d72f1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ celerybeat.pid

# Environments
.env
.envrc
.venv
env/
venv/
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 4 additions & 2 deletions src/anemoi/models/data_indices/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down

0 comments on commit b4d72f1

Please sign in to comment.