Skip to content

feat(v4): add component-level generic_data support#103

Merged
janickm merged 1 commit into
NVIDIA:mainfrom
janickm:issue-90-bionic-beaver
May 11, 2026
Merged

feat(v4): add component-level generic_data support#103
janickm merged 1 commit into
NVIDIA:mainfrom
janickm:issue-90-bionic-beaver

Conversation

@janickm
Copy link
Copy Markdown
Collaborator

@janickm janickm commented May 8, 2026

Summary

  • Add set_generic_data(data, meta_data) method to ComponentWriter for storing named numpy arrays and additional metadata at the component level
  • Defer component .zattrs writing from register_component_writer() to finalize() to support itar stores (which reject duplicate key writes)
  • Add backwards-compatible reader methods (has_generic_data, get_generic_data_names, get_generic_data) to ComponentReader

Motivation

Converters sometimes need to attach auxiliary time-series data to components without defining a custom component type. For example, a KITTI converter needs to store raw GPS/IMU measurements (30 float values per frame at 10Hz) alongside the derived ego poses. This feature provides that extensibility at the component level, mirroring the existing per-frame generic_data mechanism on sensor components.

API

Writer

poses_writer.set_generic_data(
    data={"oxts_data": oxts_array, "oxts_timestamps_us": timestamps},
    meta_data={"oxts_field_names": ["lat", "lon", "alt", ...]},
)
  • meta_data keys overwrite init-time generic_meta_data keys
  • Arrays stored with LZ4+bitshuffle compression in a generic_data/ subgroup

Reader (backwards-compatible)

reader.has_generic_data("oxts_data")        # -> bool (False for old stores)
reader.get_generic_data_names()             # -> List[str] ([] for old stores)
reader.get_generic_data("oxts_data")        # -> np.ndarray

Changes

File Description
ncore/impl/data/v4/components.py Core implementation: deferred .zattrs, set_generic_data, reader methods, super().finalize() in all subclasses
ncore/impl/data/v4/components_test.py 4 new tests: roundtrip, backwards-compat, overwrite semantics, meta-only
docs/data/formats.rst Documentation for the new component-level generic_data section

Testing

All existing tests pass unchanged. New tests cover:

  • Full write/read roundtrip (both itar and directory store types)
  • Backwards compatibility (stores without generic_data/ subgroup)
  • Metadata overwrite semantics (set_generic_data meta overwrites init-time keys)
  • Meta-only usage (empty data dict, metadata-only addition)

No new dependencies required.

@copy-pr-bot
Copy link
Copy Markdown

copy-pr-bot Bot commented May 8, 2026

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@janickm janickm self-assigned this May 8, 2026
@janickm
Copy link
Copy Markdown
Collaborator Author

janickm commented May 8, 2026

/ok to test cf53d3d

@janickm janickm force-pushed the issue-90-bionic-beaver branch from 82abbe6 to 93462e8 Compare May 8, 2026 20:08
@janickm janickm mentioned this pull request May 9, 2026
@janickm janickm force-pushed the issue-90-bionic-beaver branch from 93462e8 to edda9e6 Compare May 11, 2026 09:07
@janickm janickm marked this pull request as ready for review May 11, 2026 09:07
@janickm janickm added the enhancement New feature or request label May 11, 2026
@janickm janickm force-pushed the issue-90-bionic-beaver branch 8 times, most recently from 17780c5 to f6bf722 Compare May 11, 2026 10:39
Add set_generic_data() to ComponentWriter for storing named numpy arrays
and additional metadata at the component level. Defer component .zattrs
writing from register_component_writer() to a two-phase finalize in
SequenceComponentGroupsWriter: first each writer's finalize() runs,
then _write_component_meta() writes deferred metadata and generic data.

Writer API:
- set_generic_data(data, meta_data) sets arrays and optional metadata
- meta_data keys overwrite init-time generic_meta_data keys
- Multiple calls accumulate via merge
- Arrays stored with LZ4+bitshuffle compression in generic_data/ subgroup

Reader API (backwards-compatible):
- has_generic_data(name) -> bool
- get_generic_data_names() -> List[str]
- get_generic_data(name) -> np.ndarray
- Missing generic_data/ subgroup (old stores) handled gracefully
@janickm janickm force-pushed the issue-90-bionic-beaver branch from f6bf722 to 1888a3a Compare May 11, 2026 10:40
@janickm janickm enabled auto-merge (rebase) May 11, 2026 10:43
@janickm janickm merged commit 5ec4d7b into NVIDIA:main May 11, 2026
5 checks passed
@janickm janickm deleted the issue-90-bionic-beaver branch May 11, 2026 10:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant