write#
- lsst.images.ndf.write(obj: Any, filename: str | None = None, *, metadata: dict[str, MetadataValue] | None = None, butler_info: ButlerInfo | None = None, compression_options: Mapping[str, Any] | None = None) ArchiveTree#
Write a serializable object to an NDF (HDS-on-HDF5) file.
Parameters#
- obj
Object with a
serializemethod. May carry an_opaque_metadataattribute (aFitsOpaqueMetadata) whose primary-HDU header gets written to/MORE/FITS. This preserves FITS cards on objects that originated from a FITS read; butler provenance is conveyed throughbutler_infoinstead.- filename
Path to write to. Must not already exist. If
None, an in-memory HDF5 file is used and the on-disk artefact is discarded; the returned tree still reflects all the writes the archive made (useful for tests).- metadata, butler_info
Optional caller-supplied entries that are written into the returned
ArchiveTree.- compression_options
Optional dict forwarded to the archive constructor for h5py dataset compression.
Returns#
ArchiveTreeThe Pydantic tree the object’s
serializeproduced (withmetadata/butler_infoapplied).