imas.backends.netcdf.iterators.indexed_tree_iter¶
-
imas.backends.netcdf.iterators.indexed_tree_iter(ids: IDSToplevel, metadata: IDSMetadata | None =
None) Iterator[tuple[tuple[int, ...], IDSBase]]¶ Tree iterator that tracks indices of all ancestor array of structures.
- Parameters:
- ids: IDSToplevel¶
IDS top level element to iterate over
- metadata: IDSMetadata | None =
None¶ Iterate over all nodes inside the IDS at the metadata object. If
None, all filled items in the IDS are iterated over.
- Yields:
(aos_indices, node) for all filled nodes.
Example
>>> ids = imas.IDSFactory().new("core_profiles") >>> ids.profiles_1d.resize(2) >>> ids.profiles_1d[0].time = 1.0 >>> ids.profiles_1d[1].t_i_average = [1.0] >>> list(indexed_tree_iter(ids)) [ ((), <IDSStructArray (IDS:core_profiles, profiles_1d with 2 items)>), ((0,), <IDSFloat0D (IDS:core_profiles, profiles_1d[0]/time, FLT_0D)>), ((1,), <IDSNumericArray (IDS:core_profiles, profiles_1d[1]/t_i_average, FLT_1D)>) ] >>> list(indexed_tree_iter(ids, ids.metadata["profiles_1d/time"])) [ ((0,), <IDSFloat0D (IDS:core_profiles, profiles_1d[0]/time, FLT_0D)>), ((1,), <IDSFloat0D (IDS:core_profiles, profiles_1d[1]/time, empty FLT_0D)>) ]
Last update:
2026-01-28