FileArchive

class emmet.archival.core.FileArchive(**data)

Bases: FileArchiveBase

Class supporting generic file archiving.

The intended use of this class is to archive raw data from postprocessing steps which produce non-VASP-like output, e.g., phonopy or LOBSTER output.

Parameters

files : list of .Path

classmethod from_directory(dir_name, depth=1, compression=CompressionType.ZSTD)

Ingest raw bytes data to prepare for hierarchical archiving.

This class will create nested hierarchical data structures as needed to reflect the file system.

Return type:

Self

Parameters:
  • dir_name (PathLike)

  • depth (int | None)

  • compression (CompressionType | str | None)

Thus, a file structure like this:

./some_data.txt ./sub_dir/other_data.txt ./sub_dir/nested_sub_dir/even_more_data.txt

will result in a hierarchical structure like this:

/some_data.txt : h5py.Dataset or zarr.Array /sub_dir : h5py or zarr .Group /sub_dir/other_data.txt : h5py.Dataset or zarr.Array /sub_dir/nested_sub_dir/ : h5py or zarr .Group /sub_dir/nested_sub_dir/even_more_data.txt : h5py.Dataset or zarr.Array

Parameters

dir_namePathLike

The name of the directory to ingest data from.

depthint or None, default = 1

If an int, the maximum depth this constructor searches for data. In the example above, depth =

1 would only save files in sub_dir 2 save files in sub_dir and sub_dir/nested_sub_dir None save all files in dir_name, searching recursively

compressionCompressionType or None

Whether to compression data, defaults to zstd.

Returns

FileArchive

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

Parameters: