uwacan._core.DatasetWrap.load#
- classmethod DatasetWrap.load(path, lookup_class=True, **kwargs)#
Load data from a Zarr file and optionally restore the original class.
This method loads data from a Zarr file and attempts to reconstruct the original class that was used to save the data. The class information is stored in the
__uwacan_class__attribute of the dataset. If the class is found, the method dynamically loads and instantiates it.- Parameters:
- pathstr or pathlib.Path
The file path from which to load the data.
- lookup_classbool, default=True
If True attempts to restore the original class from the metadata stored in the Zarr file. If False, the called class is used to load the data.
- Returns:
- objcls or
__uwacan_class__ An instance of the class used to save the data (if found in the Zarr file’s metadata), or an instance of the called class.
- objcls or
Notes
The Zarr file should have the
__uwacan_class__attribute in the dataset’s metadata to allow class reconstruction.If the class cannot be found, or if there is an error during dynamic import, the method falls back to using the current class
clsto instantiate the object.