Skip to content

Load variables not in the data standard with a warning - #210

Merged
DoctorRabbit55 merged 1 commit into
GFZ:mainfrom
sahiljhawar:load-any-var
Oct 28, 2026
Merged

DoctorRabbit55 merged 1 commit into
GFZ:mainfrom
sahiljhawar:load-any-var

Conversation

@sahiljhawar

Copy link
Copy Markdown
Contributor

Summary

DataSet can now load saved files that contain variables which are not part of the current data standard. Previously this raised AttributeError: Cannot set attribute '...'. It is not part of the saving strategy, so a file written by a branch with an extended (or older, renamed) standard could not be loaded from another branch. Such variables are now attached to the dataset and a warning is logged.

Feature / enhancement

  • Feature: tolerate unknown variables when loading saved files.

Design notes

  • Only the load path in DataSet._load_variable changed. Unknown names are set with object.__setattr__ and a logger.warning.
  • __setattr__ is untouched, so user-set typos like ds.typo = 1 still raise.

Checklist

  • SPDX headers already present on changed files.
  • ruff check / ruff format clean.
  • Test added (test_variable_missing_from_standard_is_loaded_with_warning, marked basic); tests/unittests/dataset passes.
  • Backwards compatible: only turns a previous error into a warning.

@DoctorRabbit55
DoctorRabbit55 merged commit 521fd70 into GFZ:main Oct 28, 2026
12 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants